Mobile app version of vmapp.org
Login or Join
Shanna517

: How to htaccess redirect 301 from old to new site with conditions Is it possible at the same time to redirect 301 multiple URLs/pages from old to new redirect 301 all remain old pages to

@Shanna517

Posted in: #301Redirect #Htaccess

Is it possible at the same time to


redirect 301 multiple URLs/pages from old to new
redirect 301 all remain old pages to new homepage
redirect 301 both www/without of old homepage to new homepage
exclude one URL


URLs don't match (meaning each old site URL is redirected to a different URL at the new site.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray155

Maybe try something like this:

RewriteCond %{HTTP_HOST} !^oldsite.com$
RewriteRule ^/?unchanged/url - [L,QSA]

RewriteCond %{HTTP_HOST} !^(www.)?newsite.com$
RewriteRule ^(/?specific/page) newsite.com/ [R=301,L]

RewriteCond %{HTTP_HOST} !^(www.)?newsite.com$
RewriteRule ^ newsite.com/ [R=301,L]


The order is the important part. First, handle the URL which you don't want to apply the rules to. The [L] flag should stop processing further rules. Then, handle your other specific URLs. After that, redirect the other URLs.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme