Email
Email

Reputation: 2425

htaccess redirect all pages/variables/path except

move from subdomain

http://randy.savage.com

to

http://www.randy.com

i would like that http://randy.savage.com/path/path/path will be transported to the new domain also.

Except

http://randy.savage.com/you/are/pretty

http://randy.savage.com/maybe/dance

etc.

those should stay like they are

how can this be done?

Upvotes: 1

Views: 61

Answers (1)

anubhava
anubhava

Reputation: 786329

put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^randy\.savage\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/(you/are/pretty|maybe/dance) [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]
RewriteRule ^ http://www.randy.com%{REQUEST_URI} [L,NE,R=301]

Upvotes: 1

Related Questions