CodeIgniter Forums
help - www breaks my site - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: help - www breaks my site (/showthread.php?tid=17340)



help - www breaks my site - El Forum - 04-02-2009

[eluser]bgreene[/eluser]
my site works fine as long as people enter http://ecoland.com but if they enter http://www.ecoland.com the ajax wont work (i presume because that it is looking to http://ecoland.com which it sees as a different address). it gets this value from site_url(blah) i've done a print_r of $_server vars but none of them show me if it is http://www.ec or http://ec. is there some way of routing all http://www.eco to http://eco
many thanks.
Bill


help - www breaks my site - El Forum - 04-02-2009

[eluser]pistolPete[/eluser]
If you are on apache, use a .htaccess file and mod_rewrite:

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



help - www breaks my site - El Forum - 04-02-2009

[eluser]Nevio[/eluser]
You need to force all www.ecoland.com requests to ecoland.com by setting up .htaccess rules


lmao same code as above... well lol ( pistolPete when I write new post u posted the same thing as I did. Well almost the same. )


help - www breaks my site - El Forum - 04-02-2009

[eluser]bgreene[/eluser]
Super, very many thanks for that. I had no idea where to look


help - www breaks my site - El Forum - 04-02-2009

[eluser]slowgary[/eluser]
You should have a CNAME record in your DNS that handles this. You can use mod_rewrite to solve the problem, as stated above. The issue with that is not only will it require you to have a server that allows mod_rewrite but your web server will be handling that (albeit small) overhead instead of your DNS server. There may be other reasons that the CNAME route is better but I don't know them.


help - www breaks my site - El Forum - 04-02-2009

[eluser]bgreene[/eluser]
Hi Slowgary
I'm afraid my eyes glazed over when I saw your reply just now. The htaccess worked fine. What you wrote is way out of my league and likely to give me a heart attack. When the world comes out of its recession I'll pay some hitman to rewrite the program the way it _should_ be. until then people will just have to suffer with a slow site 8=(
Many thanks
Bill