简体   繁体   中英

Mod_rewrite Subdomain Folder to Root Domain

I want to rewrite a folder on my Subdomain:

sub.domain.com/folder

to my main domain

domain.com/folder

I've tried this, but it doesn't work:

RewriteCond %{HTTP_HOST} ^sub\\.domain\\.com/folder RewriteRule ^(.*)$ https://domain\\.com/folder/$1 [L]

You can use this :

RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
RewriteCond %{REQUEST_URI} ^/folder
RewriteRule ^(.*)$ /$1 [L]

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