.htaccess按文件夹重定向访问



我有一个目录,像:

> public_html/
> |-- demo1/
> |   |-- templates/
> |   |   |-- temp1/ (all html for demo purpose)
> |   |   |-- temp2/ (all html for demo purpose)
> |   |   |-- temp3/ (all html for demo purpose)

demo1是mydomain.local的主要内容,我使用了这个htaccess,我试图访问temp1, temp2和temp3,但不工作

RewriteCond %{HTTP_HOST} ^(www.)?mydomain.local$
RewriteCond %{REQUEST_URI} !^/demo1/
RewriteRule ^(.*)$ /demo1/$1
RewriteRule ^(/)?$ demo1/index.html [L]

我需要做的是访问temp1而不显示demo1/templates/

例如

http://mydomain.local/temp1

http://mydomain.local/demo1/templates/temp1

try this

RewriteRule ^(.*)$ /demo1/templates/$1 [L]

最新更新