简体   繁体   中英

redirection from subdomain to subdirectory is not working

I have migrated my wordpress blog from subdomain to subdirectory.So I have implemented blog.example.com to https://www.edgrab.com/blog and everything has been working fine except few things.

1. https://blog.example.com/post-name is not redirecting to https://www.example.com/blog/post-name and giving internal server error 500 whereas blog.example.com is redirecting successfully to https://www.example.com/blog

my .htaccess file is

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^blog\.example\.com
RewriteRule ^(.*)$ https://www\.example\.com/blog/$1 [L]

Redirection from subdomain to subdirectory from .httaccess

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain\.com/subdomains/%1

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