Page 1 of 1

rewrite cond and rule.

Posted: Mon Aug 18, 2008 11:39 pm
by geethalakshmi
Hi,

I don't know much about rewrite cond and rule.

I have several categories that are dynamically set so the url looks similar to,

Code: Select all

 
Code:
http://www.example.com/fold/index.php?rid=1
http://www.example.com/fold/index.php?rid=2
 
 
But what I want is urls that look like:
Code:
http://www.example.com/fold/ss page
http://www.example.com/fold/tt page
 
Regards,
geetha

Re: rewrite cond and rule.

Posted: Tue Aug 19, 2008 3:39 am
by gurjit
create a .htaccess file in your root folder with the following rewrite rule:

Code: Select all

 
RewriteBase /
RewriteEngine on
 
RewriteRule ^([0-9]+)/([a-zA-Z-]+)/([a-zA-Z-]+)/$ /fold/index.php?rid=$1 [L]
 
 
The href link will need the rid passed through, so the ([0-9]+) will be the rid. I have included this at the start of the folder structure, feel free to shift it around.

so your href links should be something like

2/fold/whatever/

Re: rewrite cond and rule.

Posted: Tue Aug 19, 2008 7:36 am
by The_Anomaly
I'm not sure what OS yo'ure using, or if you're having trouble setting up the rewrite on the server, but this link truly saved me with that. I spent hours trying to get it to work--and this fixed it. Just throwing that out there, in case you're having that problem.