dimabin
dimabin

Reputation: 107

RewriteRule for the root page

I need the following:

(1) mysite.com should not be redirected.

(2) mysite.com/index.html should not be redirected.

But the rest of pages on this domain should be redirected:

(3) mysite.com/xxx should be redirected to new.mysite.com/xxx

The following .htaccess works perfectly for points (2) and (3):

RewriteEngine On
RewriteRule ^index\.html$ - [L]
RewriteRule ^(.*)$ http://new.mysite.com/$1 [R=301,L]

But how can I realize point (1)?

Upvotes: 0

Views: 39

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

To exclude your root, just put the following condition above your rule

RewriteCond %{REQUEST_URI} !^/$

Upvotes: 1

Related Questions