简体   繁体   中英

Redirecting to a subdomain without changing the url using htaccess

I have the following url www.abc.xyz.com which redirects to www.xyz.com/abc and I am trying to create an htaccess file that will keep the url as www.abc.xyz.com but I am unable to do so with the following file

RewriteEngine on
RewriteCond %{HTTP_HOST} ^abc.xyz.com [NC]
RewriteRule ^/(.*)$ /abc/$1 [L]

what am I doing wrong here ?

Have this rule in DocumentRoot/.htaccess :

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?abc\.xyz\.com$ [NC]
RewriteRule ^((?!abc/).*)$ abc/$1 [L,NC]

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