Htaccess URL rewriting method

I need to rewrite my site url for seo reason. For example current “about” page url of my site is http://localhost/beautiful/?option=content&cat_id=1&itemId=1.sf
I want to rewrite it as http://localhost/beautiful/content/about
I have tried it with the following htaccess rule

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^beautiful/(.)/(.)/(.*)$ beautiful/index.php?option=$1&cat_id=$2&itemId=$3 [L]

but it’s not working. can anyone help me please?

arif,

Your regex requires three atoms separated by /'s following beautiful/ - your beautiful/content/about only has two so NO MATCH.

If you need more information about mod_rewrite (believe me, using (.*), you DO), please refer to the tutorial Article linked in my signature.

Regards,

DK

Hi David
thanks for your reply. but still i can’t figure it out.

ari,

If you’re familiar with regular expressions, it’s trivial. If you’re not, mod_rewrite is not the tool for you.

For instance, your URI is beautiful/?option=content&cat_id=1&itemId=1.sf and you want to rewrite beautiful/content/about to that URI.

Therefore, you need to capture content and … duh … about is not a value in the query string.

Normally, you’d have beautiful/value1/value2/value3 and redirect that to beautiful/index.php?option=value1&cat_id=value2&itemId=value3. You only have two values so, unless one of your values is fixed, you just can’t do this.

Regards,

DK

Have you change all those rewrite mod modules at httpd.conf? If you had already done so, perhaps it should work fine. Or you can post your sample URL for us to know better.