0

hai all,

i want to rewrite url in myproject. the actual url is http://test.com/cat_product.php?cid=2 i want this url change to http://test.com/cat_product.php how do i write .htaccess file.


i tried like this

<FilesMatch "\.(htm|html)$">
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^cat_product-([0-9]+)\.php$ cat_product.php?cid=$1
</IfModule>

but it is not working , please any one have idea help me.

thnks.

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by raju_boini525
0

Try this

RewriteEngine on
RewriteRule ^cat_product.php?cid=([0-9]+)$ /cat_product.php
0

If you will use /$1 you will get the value of cid
please read on net more on it.

RewriteEngine on
RewriteRule ^cat_product.php?cid=(.*?)$ /cat_product.php/$1

0

thanks for reply,
my .htaccess file here,

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.test.com$
RewriteRule ^$ index.php [L]
RewriteRule ^index index.php [L]
RewriteRule ^aboutus aboutus.php [L]
RewriteRule ^category/(.*) cat_product.php?name=$1 [NC]
RewriteRule ^brands/([a-zA-Z0-9_-]+[^.]+)$ brand_product.php?bname=$1 [NC]
RewriteRule ^carriers/([a-zA-Z0-9_-]+[^.]+)$ categories_name.php?cname=$1 [NC]
RewriteRule ^manufacturers/([a-zA-Z0-9_-]+[^.]+)$ categories_name.php?mname=$1 [L]
RewriteRule ^([^-]*)-([a-zA-Z0-9_-]+[^.]+)$ product_info.php?catname=$1&itemno=$2 [NC]

this is working fine in my localhost but it is not working server(www.test.com). i am geting 404 error ,

why do i get this 404 error . plz help me.

thnks,

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.