0

Hello,

I need some help in url rewrite i tried alot but not able to get this done.

Have a look at url

http://www.mydomain.com/insurance/metatags.php?cat_id=44


I need to rewrite to make html file

Below is the code I m using but no success

Options +FollowSymLinks
RewriteEngine on
RewriteRule metatags-cat_id-(.*)\.htm$ metatags.php?cat_id=$1


Also DO i need add / write some code in php file also to make this work ?

One guy said have u just added .htaccess

I relied: yes

he said then this will not work

SO Can any one help me out with this.

Thanks
DSS

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by TopDogger
0

Working with mod_rewrite can be tricky, especially if you are working with subdirectories.

Do your hyperlinks use this format? /insurance/metatags-cat_id-44.htm

try this

RewriteRule ^insurance/metatags-cat_id-(.*)\.htm$ insurance/metatags.php?cat_id=$1

it might also work this way:

RewriteRule ^metatags-cat_id-(.*)\.htm$ metatags.php?cat_id=$1


A couple of things you need to know about the .htaccess file.

1. It does not work on a Microsoft server.

2. It will not work with all hosting companies. Some hosting companies disable server overrides.

0

The best idea is not to use .*

RewriteRule ^insurance/metatags-cat_id-([0-9]+)\.htm$ insurance/metatags.php?cat_id=$1

0

I agree with php_deamon. If you are expecting numbers only, then his method limits the rewrite rule to numbers.

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.