Welcome Guest, Not a member yet? Register   Sign In
Force www?
#1

[eluser]robustus[/eluser]
This is probably a silly question, but how do I force codeigniter to make sure the "www" subdomain is present in the url string? For example, if the user types "mydomain.com", I want that to resolve as "www.mydomain.com". ... I'm using ajax via jquery and apparently the subdomain has to match exactly in order for it to work.

Is this something that's done on the CI level, or do I have to use .htaccess or something?
#2

[eluser]InsiteFX[/eluser]
.htaccess tips and tricks

InsiteFX
#3

[eluser]mahni1390[/eluser]
:question: :exclaim:

you can use .htaccess. to solve it

[url="http://www.parscanada.com"]مهاجرت به کانادا[/url]
#4

[eluser]robustus[/eluser]
And to actually be complete in response, here's what solved it:

Below is the root .htaccess file, and I have the base_url set to "http://www.mydomain.com/" in my CI config.


RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]




Theme © iAndrew 2016 - Forum software by © MyBB