![]() |
Redirect site.com to www.site.com automaticly - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Redirect site.com to www.site.com automaticly (/showthread.php?tid=21398) |
Redirect site.com to www.site.com automaticly - El Forum - 08-09-2009 [eluser]serhat[/eluser] Hello, When i enter site.com the url bar has no www. in front of domain name automaticly. I want to do this automaticly for seo purposes. How can i do this? By the way in internal urls like "site.com/blabla" i want it to be as "www.site.com/blabla" automaticly. Thanks for help By the way This is my current htaccess Code: <IfModule mod_rewrite.c> Redirect site.com to www.site.com automaticly - El Forum - 08-09-2009 [eluser]Paul Rose[/eluser] I have a system that manages multiple domains from the same CI installation. We simply set the CNAME of a domain to point where we want. Havig multiple domains meant I didnt want to edit the .htaccess every time we added a new domain in so this was the solution..... Code: RewriteCond %{HTTP_HOST} !^(www.*) Redirect site.com to www.site.com automaticly - El Forum - 08-09-2009 [eluser]serhat[/eluser] It works great but with one problem now when i enter urls these are my responses in url bar url.com => www.url.com/ ->This is great www.url.com => www.url.com/ -> This is also great www.url.com/blablabla => www.url.com/blablabla This is also great url.com/balbalba = > www.url.com/index.php/blabla This is the problem . I already removed index.php from my website from config. And i changed htaccess settings for it as you can see. Redirect site.com to www.site.com automaticly - El Forum - 08-09-2009 [eluser]jdfwarrior[/eluser] why dont you just check your server variables? Redirect site.com to www.site.com automaticly - El Forum - 08-09-2009 [eluser]jurosik[/eluser] hi, i'm using this code: Code: RewriteCond %{HTTP_HOST} ^domain.tld try it and let us know.. |