Basic SEO htacces URL rewriting
One of the most important and user friendly ways to increase the searchability of your brand new site is to make the URLs a little bit easier for the user (and the robots) to use.
e.g. Instead of
www.mysite.com/html/shop.php?catId=1&sub_catId=2&catName=Electronics&sub_catName=tv
you can have something like:
www.mysite.com/shop/1/2/Electronics/tv
(As we can see we have the original categoryId (1) and subCategoryId(2) in the URL)
To make that happen the only thing that you need is to change the .htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^shop/([0-9]+)/([0-9]+)/([A-Za-z]+)/([A-Za-z]+) /html/shop.php?catId=$1&sub_catId=$2&catName=$3&sub_catName=$4 [NC,L]
</IfModule>
If you want to have in the URL other non-latin language (e.g. Greek) your Regular expression in the rewrite rule should change and instead of the above expression you can have:
RewriteRule ^shop/([0-9]+)/([0-9]+)/([^/.]+)/([^/.]+) /html/shop.php?catId=$1&sub_catId=$2&catName=$3&sub_catName=$4 [NC,L]
which means match everything apart from the / and . character
Just try it!
For more information about what does all these mean stay tuned or just Google it!!
e.g. Instead of
www.mysite.com/html/shop.php?catId=1&sub_catId=2&catName=Electronics&sub_catName=tv
you can have something like:
www.mysite.com/shop/1/2/Electronics/tv
(As we can see we have the original categoryId (1) and subCategoryId(2) in the URL)
To make that happen the only thing that you need is to change the .htaccess file
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^shop/([0-9]+)/([0-9]+)/([A-Za-z]+)/([A-Za-z]+) /html/shop.php?catId=$1&sub_catId=$2&catName=$3&sub_catName=$4 [NC,L]
</IfModule>
If you want to have in the URL other non-latin language (e.g. Greek) your Regular expression in the rewrite rule should change and instead of the above expression you can have:
RewriteRule ^shop/([0-9]+)/([0-9]+)/([^/.]+)/([^/.]+) /html/shop.php?catId=$1&sub_catId=$2&catName=$3&sub_catName=$4 [NC,L]
which means match everything apart from the / and . character
Just try it!
For more information about what does all these mean stay tuned or just Google it!!
Σχόλια