.htaccess htaccess 403不工作自定义页
我的.htaccess文件: 当我尝试访问该页面时:http://example.com/login1.php 我得到一个错误:.htaccess htaccess 403不工作自定义页,.htaccess,.htaccess,我的.htaccess文件: 当我尝试访问该页面时:http://example.com/login1.php 我得到一个错误: Forbidden You don't have permission to access /login1.php on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handl
Forbidden
You don't have permission to access /login1.php on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
但我想在404页上显示消息。php您的规则正在循环,因为一旦您为/login1.php发出禁止一次,它将继续抛出403,因为%{u请求}不会更改 有这样的规则来解决它:
RewriteRule ^404\.php$ - [L,NC]
# If the request sent by the browser includes login1.php...
RewriteCond %{THE_REQUEST} (index|login1)\.php
RewriteRule ^ - [F]
ErrorDocument 403 /404.php
ErrorDocument 404 /404.php
# Then you just need a generic rule to rewrite /mysite into login1.php
RewriteRule ^mysite$ login1.php [L]
RewriteRule ^$ index.php [L]
请注意错误消息的这一部分:此外,在尝试使用ErrorDocument处理请求时遇到500内部服务器错误。检查Apache错误日志,查看是什么导致了500错误。
RewriteRule ^404\.php$ - [L,NC]
# If the request sent by the browser includes login1.php...
RewriteCond %{THE_REQUEST} (index|login1)\.php
RewriteRule ^ - [F]
ErrorDocument 403 /404.php
ErrorDocument 404 /404.php
# Then you just need a generic rule to rewrite /mysite into login1.php
RewriteRule ^mysite$ login1.php [L]
RewriteRule ^$ index.php [L]