我需要隐藏URL的文件夹。
I need to hide a folder from a url.
一个例子:
如果我输入 www.mysite/Jango 我需要你阅读目录: www.mysite/users/Jango 但不希望看到 /用户
If I enter www.mysite/Jango I need you to read the directory: www.mysite/users/Jango but do not want to see /users
我只是想看看这个在地址栏中输入: www.mysite/Jango
I just want to see this in the address bar: www.mysite/Jango
推荐答案本的.htaccess 在 / 应该做的
RewriteEngine on RewriteCond %{REQUEST_URI} !^users/ RewriteRule ^(.*)$ users/$1 [L]这把任何requset不是以用户/ 因为如果它这样做。
This treats any requset not starting with users/ as if it did.
更新: 如果你希望规则适用于仅 /詹 - > /用户/詹,这将是适当的的.htaccess :
Update: If you want the rule to apply for only /Jango --> /users/Jango, this would be an appropriate .htaccess:
RewriteEngine on RewriteCond %{REQUEST_URI} !^users/Jango RewriteRule ^Jango/(.*)$ users/Jango/$1 [L]
(将 [L] -flag停止重写afther这个规则,preventing可能的圆圈反应等)
(The [L]-flag stops rewriting afther this rule, preventing possible circle-reactions etc)
更多推荐
使用隐藏的.htaccess文件夹中的网址
发布评论