Akin A
Akin A

Reputation: 43

Htaccess URL Rewriting [GET doesn't works]

In my site I use "show.php?cat=1" type URLs. I want to change for SEO optimization this link types.

I have tried before but I can't understand how to do that.

# Root Host
-- Project Folder
--- index.php
--- show.php
--- css/js/ and other folders

My first purpose is change my links

show.php?cat=1 to show/1/

my code is

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^/show/(.*)$ show.php?cat=$1 [QSA,L]

But it doesn't work. I have a GET error. What's wrong?

And my css files gone to /show/css URL

I'am very angry, my css files gone but Get function doesn't work.

Thanks for help.

Edit: If I change show code to 'test' like that, page becomes 404. Why? Note: I'am using WAMP Server 3, Apache Rewrite_module is working.

RewriteRule ^/test/(.*)$ show.php?cat=$1 [QSA,L]

"The requested URL /project1/test/1 was not found on this server."

Upvotes: 0

Views: 227

Answers (1)

Croises
Croises

Reputation: 18671

Use:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteRule ^show/(.*)$ show.php?cat=$1 [QSA,L]

Without first / in htaccess RewriteRule pattern

Upvotes: 1

Related Questions