CodeIgniter Forums
htaccess question - 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: htaccess question (/showthread.php?tid=18028)



htaccess question - El Forum - 04-23-2009

[eluser]ggoforth[/eluser]
So this isn't a typical how do I remove my index.php htaccess question, more of a general rewriting question. Lets say I developed a site at:

www.somesite.com

After a while I redesigned the site on a subdomain www2. How would I use htaccess and mod rewrite to have any www urls be rewriten as www2?

So going to:

www.somesite.com

would show you the page from

www2.somesite.com

Hope that makes sense.

Thanks!

Greg


htaccess question - El Forum - 04-23-2009

[eluser]TheFuzzy0ne[/eluser]
Something like this might work:

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



htaccess question - El Forum - 04-23-2009

[eluser]Daniel Moore[/eluser]
TheFuzzy0ne is correct. I currently use that exact setup on a site now.


htaccess question - El Forum - 04-24-2009

[eluser]ggoforth[/eluser]
thanks guys! I will check this out and see if I can't get that to work!