简体   繁体   中英

I want to redirect all the sub-folder pages to subdomain how do i do?

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?

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] 

Edit .htaccess file and add new line

        Redirect /amp/page-name https:///m.domain.com/page-name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM