简体   繁体   中英

Redirection from Subdomain to subdirectory

I want to redirect test.subdomain.com to subdomain.com/web

I want to redirect all pages and posts as well.

I did redirection from cpanel it will redirects only home page and then I put some code in .htaccess

This code is not working for me.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.subdomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.subdomain\.com$
RewriteCond %{HTTP_HOST} ^www\.test\.subdomain\.com\blog
RewriteRule ^/?$ "https\:\/\/subdomain\.com\/web" [R=301,L]
RewriteRule ^(.*) http://www.subdomain.com/web/%{REQUEST_URI} [R=302,NC]
RewriteRule ^(.*) http://www.subdomain.com/web/blog/%{REQUEST_URI} [R=302,NC]
</IfModule>

Redirection is a wordpress plugin that supports the feature you're inquiring about.

https://en-gb.wordpress.org/plugins/redirection/

https://snag.gy/vFp2j3.jpg

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