Php Htaccess区分大小写的重写条件问题
我已经为我的网站写了如下重写规则Php Htaccess区分大小写的重写条件问题,php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,我已经为我的网站写了如下重写规则 RewriteEngine on DirectoryIndex index.html index.php RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d [NC] RewriteRule ^([^.php].+) /details.php?name=$0 当我尝试www.example.com/example时,它将被重定向到www.exampl
RewriteEngine on
DirectoryIndex index.html index.php
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^([^.php].+) /details.php?name=$0
当我尝试www.example.com/example时,它将被重定向到www.example.com/details.php?name=example。
但是我试着像www.example.com/example一样访问它,但是失败了
请告诉我如何解决此问题?您可以添加
CheckSpelling on
总结
CheckSpelling是一种很好的方式,可以让网站体验到更“宽容”的体验,并且可以消除错误日志的负担,因为它可以用于自动更正文件请求。激活后,此“拼写检查器”将请求目录中的每个文档名与请求的文档名进行比较,而不考虑大小写,并且最多允许一次拼写错误(字符插入、省略、换位或错误字符)
启用检查拼写的示例:打开检查拼写。
实际上,问题似乎在于您的规则使用了不正确的正则表达式 使用此规则:
RewriteEngine on
DirectoryIndex index.html index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ /details.php?name=$1 [L,QSA]