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
Apache 使用双斜杠设置404错误。htaccess_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 使用双斜杠设置404错误。htaccess

Apache 使用双斜杠设置404错误。htaccess,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,如何在.htaccess中使用URL中的双斜杠设置404错误?问题是我的cur.htaccess不是空的 AddType application/x-httpd-php .php .html ErrorDocument 404 /404.php <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / # redirect from index.

如何在.htaccess中使用URL中的双斜杠设置404错误?问题是我的cur.htaccess不是空的

AddType application/x-httpd-php .php .html

ErrorDocument 404 /404.php

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    # redirect from index.(php|asp|aspx|html|htm), main.(php|asp|aspx|html|htm), home.(php|asp|aspx|html|htm)
    RewriteRule ^(.*)index\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
    RewriteRule ^(.*)main\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
    RewriteRule ^(.*)home\.(php|asp|aspx|html|htm)$ $1 [R=301,L]
    RewriteRule ^(.*)default\.(php|asp|aspx|html|htm)$ $1 [R=301,L]

    RewriteCond %{HTTP_HOST} ^(www|dev)\.site\.ru$ [NC]
    RewriteRule ^(.*?)((?:index|default|home)\.(?:php|html?))?$ http://site.ru/$1 [R=301,L,NC]
</IfModule>
AddType应用程序/x-httpd-php.php.html
ErrorDocument 404/404.php
选项+FollowSymLinks
重新启动发动机
重写基/
#从索引重定向。(php | asp | aspx | html | htm),main.(php | asp | aspx | html | htm),home.(php | asp | aspx | html | htm)
重写规则^(.*)索引\(php | asp | aspx | html | htm)$$1[R=301,L]
重写规则^(*)main\(php | asp | aspx | html | htm)$$1[R=301,L]
重写规则^(.*)主页\(php | asp | aspx | html | htm)$$1[R=301,L]
重写规则^(.*)默认\(php | asp | aspx | html | htm)$$1[R=301,L]
重写cond%{HTTP|u HOST}^(www|dev)\.site\.ru$[NC]
重写规则^(.*)(?:index | default | home)\.(?:php | html?))$http://site.ru/$1[R=301,L,NC]

非常感谢。

您所说的.htaccess中的
404错误是什么意思,URL中带有双斜杠?
?例如,我有以下URL:
http://site.ru/abc.php, http://site.ru/123/dac.php
。如果我把
http://site.ru////abc.php, http://site.ru//abc.php, http://site.ru///123////dac.php, http://site.ru//123//dac.php
我需要生成404错误。清楚了吗?