Home Redirect old domain to new domain except one html file
Reply: 0

Redirect old domain to new domain except one html file

user1018
1#
user1018 Published in August 15, 2018, 11:15 am

I want to transfer old domain URL to new domain URL. For example: In my old domain have 3 files, name is

a.html, b.php, c.xml

now i want to redirect it into new domain using htaccess with out a.html file. like

old.com -> new.com
old.com/b.php -> new.com/b.php
old.com/c.xml -> new.com/c.xml
# Note this will not to redirect new domain
old.com/a.html -> old.com/a.html

as per this SO answer I tried this following code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule a\.html - [L]
RewriteRule (.*)$ http://www.new.com/$1 [R=301,L]
</IfModule>

and this Code

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/a.html [NC]
RewriteRule (.*)$ http://www.new.com/$1 [R=301,L]
</IfModule>

But it redirects in to all the pages into the new domain including a.html file. What i'm doing wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305033 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO