简体   繁体   中英

.htaccess not redirect subdomain to root path

My root path is redirected automatically to another path like this

    http://www.example.com

goes to

    http://www.example.com/fr/home

i have put this in .htaccess at the racine of mywbesite

    RedirectMatch /$ /fr/home

My problem is that when i created a subdomain named

    booking.example.com

it is always redirected automatically to be like that

    booking.example.com/fr/home

how can i fix this to let only my subdomain point only to

    booking.example.com

Thank you.

Replace your rule with this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^/?$ /fr/home [L,R]

Then test this in a separate browser to avoid old browser cache.

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