我需要一个右后我的域名给我所有的网站的网址添加额外的字。
I need to a add a extra word right after my domain name to all my website URLs.
比方说我的网址是 http://www.example.com/somecategory/someproduct.html 时,它应该是 http://www.example.com/logado/somecategory /someproduct.html 。
Lets say my url is http://www.example.com/somecategory/someproduct.html, it should be http://www.example.com/logado/somecategory/someproduct.html.
是否有可能使用.htaccess文件做呢?
Is it possible to do it with .htaccess file ?
如果这样,我应该怎么添加到我的.htaccess文件?
If so what should i add to my .htaccess file ?
您可以在 DOCUMENT_ROOT /的.htaccess
文件中使用此code:
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteBase /
# prefix each URL by /logado/ if it is not present
RewriteCond %{THE_REQUEST} !s/+logado/ [NC]
RewriteRule ^ logado%{REQUEST_URI} [R=302,L,NE]
# internally remove /logado/ from all URLs
RewriteRule ^logado/(.*)$ $1 [L,NC]