嘿,我想重写我的链接
mydomain.com/?page=pageName
到
mydomain.com/pageName
我试过
RewriteEngine On
RewriteRule ^([^/]*)$ /?page=$1 [L]
但它似乎给出错误500
答案 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]