My current .htaccess
is in httpdocs. How can I configure it to help domain point to subfolder is /vn/
and still keep: www.example.com
instead of www.example.com/vn/
In .htaccess add these lines :
RewriteEngine On
RewriteRule !^blog/ /blog%{REQUEST_URI} [L,R=301]
Or in some hosts :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomainName.com$
RewriteRule ^(/)?$ blog [L]
Try the following near the top of your .htaccess
file in the document root:
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule (.*) /vn/$1 [L]
This internally rewrites all requests that hit the document root to the /vn/
subdirectory. The RewriteCond
directive that checks against the REDIRECT_STATUS
environment variable ensures the request is only rewritten once - thus avoiding a rewrite loop.
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.