Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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 带有查询字符串的RewriteRule被重写为/param/param/_Apache_.htaccess_Mod Rewrite_Rewrite_Webmin - Fatal编程技术网

Apache 带有查询字符串的RewriteRule被重写为/param/param/

Apache 带有查询字符串的RewriteRule被重写为/param/param/,apache,.htaccess,mod-rewrite,rewrite,webmin,Apache,.htaccess,Mod Rewrite,Rewrite,Webmin,我有一条规则: RewriteRule ^gallery/([^/]+)/?$ /gallery.php?title=$1 [L] 但是,当导航到gallery/a/时,内部重定向是: gallery.php/a //(instead of: gallery.php?title=a) 什么会导致这种行为?选项多视图可能是罪魁祸首。选项MultiView由Apache的内容协商模块使用,该模块在mod_重写之前运行,并使Apache服务器匹配文件扩展。因此/file可以在URL中,但它将提供/

我有一条规则:

RewriteRule ^gallery/([^/]+)/?$ /gallery.php?title=$1 [L]
但是,当导航到gallery/a/时,内部重定向是:

gallery.php/a //(instead of: gallery.php?title=a)
什么会导致这种行为?

选项多视图可能是罪魁祸首。选项MultiView由Apache的内容协商模块使用,该模块在mod_重写之前运行,并使Apache服务器匹配文件扩展。因此/file可以在URL中,但它将提供/file.php

使用.htaccess顶部的此行将其关闭:

Options -MultiViews

太棒了,就是这样!