Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess 403不工作自定义页_.htaccess - Fatal编程技术网

.htaccess htaccess 403不工作自定义页

.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

我的.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 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]