.htaccess 如何允许使用htaccess访问目录
我希望允许访问目录,同时仍保持当前配置 当前配置如下所示:.htaccess 如何允许使用htaccess访问目录,.htaccess,.htaccess,我希望允许访问目录,同时仍保持当前配置 当前配置如下所示: DirectoryIndex index.php Index.php Options +FollowSymLinks -MultiViews #Turn mow_rewrite on RewriteEngine On RewriteBase / ## hiding .php extensions, and externally redirecting /dir/file.php to dir/file RewriteCond %{
DirectoryIndex index.php Index.php
Options +FollowSymLinks -MultiViews
#Turn mow_rewrite on
RewriteEngine On
RewriteBase /
## hiding .php extensions, and externally redirecting /dir/file.php to dir/file
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
##internally redirecting /dir/file.php to dir/file
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
问题是,这个htaccess当前配置从文件中删除了.php扩展名,
但我认为,这影响了目录,限制了对它的访问
请告诉我如何解决此问题,请尝试以下代码:
DirectoryIndex index.php Index.php
Options +FollowSymLinks -MultiViews
#Turn mow_rewrite on
RewriteEngine On
RewriteBase /
## hiding .php extensions, and externally redirecting /dir/file.php to dir/file
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NE]
##internally redirecting /dir/file.php to dir/file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]