arif65 — 2012-02-17T11:13:13-05:00 — #1
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
RewriteRule ^beautiful/(.)/(.)/(.*)$ beautiful/index.php?option=$1&cat_id=$2&itemId=$3 [L]
but it's not working. can anyone help me please?
dklynn — 2012-02-17T17:14:03-05:00 — #2
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.
arif65 — 2012-02-18T01:14:57-05:00 — #3
thanks for your reply. but still i can't figure it out.
dklynn — 2012-02-18T01:58:28-05:00 — #4
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.
davidausman — 2012-02-21T01:00:29-05:00 — #5
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.