Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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_Url_Mod Rewrite - Fatal编程技术网

.htaccess重写规则是否准确

.htaccess重写规则是否准确,.htaccess,url,mod-rewrite,.htaccess,Url,Mod Rewrite,它应该能正常工作。但这个重写规则有一个问题:事实上,它重写正确: RewriteRule ^([^/]+).html /index.php?sezione=$1 但它也重写了,不应该用 www.example.com/index.php?sezione=hello to www.example.com/hello.html 以及html扩展名之后的任何其他字符串。我怎样才能修复它?我想这就是你想要的: www.example.com/hello.htmlll www.example.com

它应该能正常工作。但这个重写规则有一个问题:事实上,它重写正确:

RewriteRule ^([^/]+).html /index.php?sezione=$1
但它也重写了,不应该用

www.example.com/index.php?sezione=hello to www.example.com/hello.html

以及html扩展名之后的任何其他字符串。我怎样才能修复它?

我想这就是你想要的:

www.example.com/hello.htmlll  www.example.com/hello.htmlfed

我还有另一个问题:重写规则^articles/([^/]+)\.html$/articles/$1[L,NC,R=301]这次重写:/articles/arttitle和/articles/arttitle/如何避免第二次重写?非常感谢。如果最后没有html,就不会重写。因此,我不理解你的问题。我的意思是有一个重复的页面:/articles/arttitle(这是一个页面)和/articles/arttitle/这是一个目录,如果我只能手动获取它的话。无论如何,这都不应该起作用。$触按123/$mkdir 123/=>错误消息,该消息表示无法写入文件夹123,因为已存在文件。
RewriteRule ^([^/]+).html$ /index.php?sezione=$1