SEO Friendly URL with Mod Rewrite from Apache

What is Mod Rewrite?

According to Wikipedia:

A rewrite engine is a piece of web server software used to modify URLs before fetching the requested item, for a variety of purposes. This technique is known as URL rewriting. A concise URL is easy to remember, and less time-consuming to type in. If the URL can be made to relate clearly to the content of the page, then errors are less likely to happen. More details about mod rewrite here.

Ok now that we have seen what Mod Rewrite actually does we will start on learning how to actually rewrite your URL.

If you have a website and your pages links form are : index.php?id_cat=10 you can optimize them to look like 10_keyword.html with a little effort and knowledges.

Create .htaccess file in root or edit if exists and add the following lines:

#Options +FollowSymLinks
#RewriteEngine on
#RewriteRule ^([0-9]+)-[a-zA-Z0-9-_]*.html$ index.php?id_cat=$1 [L]

If you don’t have knowledges about mod rewrite you can use some mod rewrite generators like Mod rewrite generator 1 , Mod rewrite generator 2 or try Google.

Place a link to your site with refference to this article,if you want to use this post!!

Link To This Post
1. Click inside the codebox
2. Right-Click then Copy
3. Paste the HTML code into your webpage