sean
sean

Reputation: 19

Rewrite URLs with .htaccess

I am trying to rewrite my URLs so they are search engine friendly.

Example URL is:

http://www.example.com/?Products=Displays&SubCat=Chalkboards-and-Accessories&Item=Budget-Framed-Chalkboards

I am thinking maybe something like this:

http://www.example.com/Chalkboards-and-Accessories/Budget-Framed-Chalkboards

Upvotes: 0

Views: 199

Answers (2)

Kasun
Kasun

Reputation: 689

Instead of using {Domain}/Chalkboards-and-Accessories/Budget-Framed-Chalkboards URL, I'm suggesting you should use {Domain}/Products/Chalkboards-and-Accessories/Cafe-and-Rope-Barrier-Systems, because in your site you are having URLs like {Domain}/?About.

Try this,

RewriteEngine On
RewriteCond %{HTTP_HOST} !^catalogue\.signalight\.co\.uk$
RewriteCond %{HTTP_HOST} !^blog\.signalight\.co\.uk$

#RewriteCond %{REQUEST_URI} !^/catalogue
#RewriteCond %{REQUEST_URI} !^/blog

RewriteRule ^([a-zA-Z0-9-_]+)/?$                                    ?$1 [L]
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/?$                   ?$1=$2 [L]
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/?$  ?$1=$2&SubCat=$3 [L]
RewriteRule ^([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)?$  ?$1=$2&SubCat=$3&Item=$4 [L]

Upvotes: 1

Related Questions