Kiel
Kiel

Reputation: 493

URL Rewrite - Internal server error

Hi I want to change the current url www.website.com/books.php?tk=3ba89ffd to www.website.com/books/3ba89ffd but my htaccess file gives me an internal server error. I am using WAMP Rewrite module is on.

Here is my .htaccess

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME}!-d
RewriteCond %{SCRIPT_FILENAME}!-f
RewriteCond %{SCRIPT_FILENAME}!-l

RewriteRule ^/books/([a-zA-Z0-9]+)$ /books.php?tk=$1 [L]

Upvotes: 1

Views: 46

Answers (2)

René Höhle
René Höhle

Reputation: 27285

I think the problem is that you can't set options in your .htaccess file. Remove that line and set the value in your vhost.

And perhaps set the -MultiViews option.

Upvotes: 1

anubhava
anubhava

Reputation: 784898

You have some syntax issues with your RewriteCond and then in pattern you need to take off leading slash as you're doing it in .htaccess.

Have it this way:

Options +FollowSymLinks -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^books/([a-zA-Z0-9]+)/?$ /books.php?tk=$1 [L,QSA,NC]

Upvotes: 1

Related Questions