SEF与mod_rewrite错误500相关联

时间:2014-08-30 11:49:38

标签: .htaccess url mod-rewrite hyperlink sef

嘿,我想重写我的链接

mydomain.com/?page=pageName

mydomain.com/pageName

我试过

RewriteEngine On
RewriteRule ^([^/]*)$ /?page=$1 [L]

但它似乎给出错误500

1 个答案:

答案 0 :(得分:0)

由于你的规则,你有一个无限循环 您必须添加条件以避免它

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/(index\.php)?$
RewriteRule ^([^/]*)$ /?page=$1 [L]

编辑:考虑您的意见

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_URI} ^/(index\.php)?$
RewriteRule ^ - [L]

RewriteRule ^([^/]*)/([^/]*)$ /?page=$1&id=$2 [L]
RewriteRule ^([^/]*)$ /?page=$1 [L]