.htaccess redirects all pages except redirecting multiple pages to a specific page

After searching for many posts here, I’m not lucky that they are a little different, but now I can’t handle it. Please forgive me about this. This post is here, I tried:

Here is what I want to purchase:

  • the entire URL at www.olddomain.com is constantly redirected to www.exampledomain.com/page,
  • and at www.olddomain.com there is a page that should be redirected to www.exampledomain.com/pagesample

Please note: old olddomain.com has no files except the index and this htaccess, and www.exampledomain.com is a WordPress site.

Thank you in advance

+4
source share
1 answer

I got a little confused about this sentence:

www.olddomain.com have a page will be redirected

I assume you mean www.olddomain.com/page redirecting to www.exampledomain.com/pagesample

RewriteEngine On RewriteCond %{HTTP_HOST} .*olddomain\.com$ RewriteCond %{REQUEST_URI} /page/ RewriteRule ^ http://www.exampledomain.com/pagesample [L,R=301] RewriteCond %{HTTP_HOST} .*olddomain\.com$ RewriteRule ^(.*) http://www.exampledomain.com/page/$1 [L,R=301] 
+2
source

Source: https://habr.com/ru/post/1445092/


All Articles