CodeIgniter Forums
Htaccess confusion - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Htaccess confusion (/showthread.php?tid=52407)



Htaccess confusion - El Forum - 06-09-2012

[eluser]Bondie[/eluser]
So, I got confused, basically I have around 10 domains that I'm looking to 301 redirect to one main domain, all setup to the same server.

*replaced domain names obviously Wink*
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (www\.)?domainone\.(com|info)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domaintwo\.(co.uk)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domainthree\.(co.uk)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domainfour\.(co.uk)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domainfive\.(co.uk)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domainsix\.(co.uk)$ [NC]
RewriteCond %{HTTP_HOST} (www\.)?domainseven\.(co.uk)$ [NC]
RewriteRule ^(.*)$ http://www.domainone.co.uk/$1 [R=301,L]

domainone.co.uk is the main domain which I also own domainone.com domainone.info

some of the domains redirect and others don't redirect, I'm not amazing with htaccess, could someone point out what I've obviously done wrong?

Regards,
Jamie


Htaccess confusion - El Forum - 06-09-2012

[eluser]Bondie[/eluser]
Solved it myself, if anyone has a similar problem this was what I used:
Code:
RewriteCond %{HTTP_HOST} (www\.)?domainone\.(com|info)$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domainthree\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domaintwo\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domainfour\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domainfive\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domainsix\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} (www\.)?domainseven\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.domainone.co.uk/$1 [R=301,L]

couldn't edit the original post, some message about spam.