-2

I wanted to redirect all the pages in a subfolder having a page link like (https:///www.domain.com/amp/page-name) to a subdomain having a page link like (https:///m.domain.com/page-name).

How should I redirect the all pages respective of the subdomain page?

Do I need to add redirection code for each page single page or is there in option so that I can redirect it in a single code?

Rp9
  • 1,855
  • 2
  • 18
  • 28
  • Possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – 04FS Oct 22 '19 at 06:32

2 Answers2

0

Try adding the following to the .htaccess file in the root directory of your webiste.com site.

RewriteEngine on
RewriteBase / 

#if not already blog.website.com
RewriteCond %{HTTP_HOST} !^blog\.website\.com$ [NC] 
#if request is for blog/, go to blog.website.com
RewriteRule ^blog/$ http://blog.website.com [L,NC,R=301] 
0

Edit .htaccess file and add new line

        Redirect /amp/page-name https:///m.domain.com/page-name
Bassem Samir
  • 114
  • 9