Htaccess mod_rewrite,一种语法工作,但其他不


htaccess mod_rewrite, one syntax works, but other no

当我在。htaccess中写入这个mod_rewrite

 RewriteEngine on
 RewriteRule ^(.*)'.my_extension$ $1.php

运行正常

但是当我尝试mod_rewrite这样:

RewriteEngine on
RewriteRule ^(.*)$ index.php?url=$1

这给我Internal Server Error时打开任何地址,例如site.com/somepage

那么,这可能是什么原因呢?

RewriteEngine on
RewriteCond %{REQUEST_URI} !(index.php)
RewriteRule ^(.*)$ index.php?url=$1

你有一个重定向循环,你需要从规则中排除index.php

相关文章: