如何从htaccess隐藏子文件夹的子文件夹?

时间:2016-06-07 06:38:01

标签: .htaccess redirect mod-rewrite hide subdirectory

我已经在我的.htacces中删除了www和/example.com/子文件夹。 它工作正常,但当我尝试访问真正的子文件夹时,它将我重定向到完整的URL

我想要的有效网址是:
example.com
example.com/app
example.com/admin

如果我点击 example.com 它可以正常工作,但是当我点击 example.com/app 时,它会重定向到 example.com /example.com/app

我尝试了this,但仍然无效

这是我的.htaccess

RewriteEngine On 
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteRule !^example.com/ /example.com%{REQUEST_URI} [L]

btw,我的文件夹结构

public_html
 └ .htaccess
 └ example.com
   └ app
   └ admin

0 个答案:

没有答案
相关问题