Dragan A.
Dragan A.

Reputation: 51

htaccess rewrite error

What is wrong with this line

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

I'm try rewrite links from

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

to

http://mysite.com/2012

But i have 500 Internal Server Error

Also here is the content from my 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]

Upvotes: 1

Views: 413

Answers (1)

anubhava
anubhava

Reputation: 785126

Replace this rule:

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

with this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]*)/?$ index.php?query=$1 [L,QSA]

Upvotes: 1

Related Questions