User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the *nix Software section within the Tech Talk category of DaniWeb, a massive community of 456,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,609 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our *nix Software advertiser: Lunarpages Linux Web Hosting
Views: 949 | Replies: 3
Reply
Join Date: Aug 2006
Location: India
Posts: 77
Reputation: dss is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
dss's Avatar
dss dss is offline Offline
Junior Poster in Training

URL rewrite

  #1  
Oct 26th, 2007
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/me....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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: somewhere in time
Posts: 81
Reputation: TopDogger is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: URL rewrite

  #2  
Nov 1st, 2007
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.
Reply With Quote  
Join Date: Aug 2006
Posts: 138
Reputation: php_daemon is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
php_daemon php_daemon is offline Offline
Junior Poster

Re: URL rewrite

  #3  
Nov 1st, 2007
The best idea is not to use .*

RewriteRule ^insurance/metatags-cat_id-([0-9]+)\.htm$ insurance/metatags.php?cat_id=$1
Reply With Quote  
Join Date: Aug 2005
Location: somewhere in time
Posts: 81
Reputation: TopDogger is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 5
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: URL rewrite

  #4  
Nov 3rd, 2007
I agree with php_deamon. If you are expecting numbers only, then his method limits the rewrite rule to numbers.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb *nix Software Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the *nix Software Forum

All times are GMT -4. The time now is 5:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC