1

这条线有什么问题

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?query=$1 [L]

我正在尝试重写链接

http://mysite.com/index.php?query=2012

http://mysite.com/2012

但我有500 内部服务器错误

这也是我的 htaccess 中的内容

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^software$ index.php?type=app
RewriteRule ^movies$ index.php?type=movie
RewriteRule ^games$ index.php?type=game
RewriteRule ^music$ index.php?type=music
RewriteRule ^other$ index.php?type=other
RewriteRule ^tv$ index.php?type=tv-show
RewriteRule ^ebooks$ index.php?type=ebooks

RewriteRule ^(.*)-(\d+)\.html$ download.php?id=$2 [L,NC]
RewriteRule ^site/([^/]*)$ /index.php?site=$1 [L]
RewriteRule ^([^/]*)$ /index.php?query=$1 [L]
4

1 回答 1

1

替换此规则:

RewriteRule ^([^/]*)$ /index.php?query=$1 [L]

有了这个:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]*)/?$ index.php?query=$1 [L,QSA]
于 2012-05-09T22:48:54.190 回答