Zoe Epix
Zoe Epix

Reputation: 63

.htaccess redirects - map all URLs but give homepage specific redirect

I have the following set up for an old domain, which works really well to mapping the old pages to the ones on the new domain.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldurl.org.uk [NC,OR]
RewriteCond %{HTTP_HOST} ^www.oldurl.org.uk [NC]
RewriteRule ^(.*)$ http://www.newurl.co.uk/$1 [L,R=301,NC]

The problem is I need to redirect the homepage to a specific page on the new URL, keeping the above in tact. Whats the best way to do this?

Thanks in advance!!

Upvotes: 0

Views: 60

Answers (1)

Croises
Croises

Reputation: 18671

You can use:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?oldurl\.org\.uk$ [NC]
RewriteRule ^$ http://www.newurl.co.uk/specificPage [L,R=301]

RewriteCond %{HTTP_HOST} ^(www\.)?oldurl\.org\.uk$ [NC]
RewriteRule ^(.+)$ http://www.newurl.co.uk/$1 [L,R=301]

Upvotes: 1

Related Questions