我具有以下htaccess规则,这些规则设置为将example.com/folder/
中的任何请求路由到自定义文件:
DirectoryIndex router.php
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
###
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
###
RewriteBase /folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/*([^/]*/?[^/]*)/*$ router.php?url=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/*$ router.php?url=
####RewriteOptions Inherit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ 404.php [L,QSA]
如果我想引发自定义404错误,并且用户尝试精确访问/folder/
,该如何添加这些规则?
(我想继续允许其他可能的选项,例如/folder/widget/
,我只是/folder/
下没有任何要显示的内容,这只是SEO的名称)