Reputation: 121
I'm completely helpless when it comes to htaccess. I've tried and tried and can't seem to understand it.
I'm trying to rewrite
http://somedomainname.com/index.php?route=product&make=Samsung&model=1001SHD
to the link below
http://somedomainname.com/Samsung-1001SHD-TV-Set
The TV-Set
would be a static addition to each URL. It will be the same across the entire site.
Any tips, pointers, code, or a finger in the right direction would be very much appreciated it.
Thanks
Upvotes: 0
Views: 31
Reputation: 785058
You can use these rule in your site root .htaccess:
RewriteEngine On
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /index\.php\?route=product&make=([^\s&]+)&model=([^\s&]+) [NC]
RewriteRule ^ /%1-%2-TV-Set? [R=301,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^([^-]+)-([^-]+)-TV-Set/?$ index.php?route=product&make=$1&model=$2 [L,QSA,NC]
Upvotes: 1