如何在不使用扩展名的情况下使用DirectoryIndex

时间:2019-06-06 13:26:12

标签: .htaccess

我的.htaccess文件中有此代码

DirectoryIndex  http://localhost/login
ErrorDocument 404 /errors-404.html
ErrorDocument 403 /errors-404.html

<Files server.php> 
    Deny from all
    ErrorDocument 403 /errors-404.html
</Files>

RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.+)\.php - [F,L]
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^([a-zA-Z0-9]+)(/)?$ $1.php


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

我的htaccess的使用是当用户执行site.com/login.php时,他们将重定向到错误404,并且该页面仅在site.com/login中可访问,但是当我在DirectoryIndex中使用login.php时,它显示给我494页。谁能帮我使用DirectoryIndex

0 个答案:

没有答案
相关问题