简体   繁体   中英

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."

Use:

Options +FollowSymLinks -MultiViews
RewriteEngine on

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

Without first / in htaccess RewriteRule pattern

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM