当用户点击时
- http://localhost/mywebsite/folder1
这个链接我的htaccess正在工作。
但是当用户点击时
- http://localhost/mywebsite/folder2
我的网站重定向至
- http://localhost/folder2
因为我的网站在我的目录结构中包含 folder2。
当用户点击时
- http://localhost/mywebsite/folder2
我的htaccess应该忽略此URL,因为我想将用户重定向到索引.php该索引存在于文件夹2中
下面编写的代码存在于我的htaccess文件中
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我该怎么办?请帮助我解决这个问题。
假设您要排除文件夹"exclude_me"。添加
RewriteCond %{REQUEST_URI} !^/exclude_me/.*$
为我做诀
试试这个:
重写引擎打开
重写规则 ^(.*)/$/$1 [L,R=301]
RewriteCond %{REQUEST_URI}!^/excluded-folder/
RewriteCond %{REQUEST_FILENAME} !-f
重写规则 ^ 索引.php [L]