[SOLVED]rewrite cgi+catid

New to mod_rewrite? This is a good place to start.

[SOLVED]rewrite cgi+catid

Postby pat99 » Fri Sep 04, 2009 11:02 pm

Hello Richard

I am trying to write a rewriting, now I am getting this:

http://www.mysite.com/tools/sale.cgi?catid=293

and I'd like:


http://www.mysite.com/tools/categoryname.html

in my script the call to categories is like this:

<a href="sale.cgi?catid=293">Videos games</a>

How should I modify the script and write the rewriting?

Thanks

Pat
Last edited by pat99 on Sun Sep 06, 2009 10:40 pm, edited 1 time in total.
pat99
 
Posts: 10
Joined: Sat Jul 26, 2008 11:31 pm

Postby richardk » Sat Sep 05, 2009 8:19 am

richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby pat99 » Sat Sep 05, 2009 10:08 am

Yes i did an my htaccess loks like that:

RewriteRule ^sale/([0-9]+)-[^/]+\.html$ /sale.cgi?catid=$1 [QSA,L]

it does nothing so i probably need explanation on how to modify the type of url below ...


<a href="sale.cgi?catid=267">Tools</a>

Thanks

Pat
pat99
 
Posts: 10
Joined: Sat Jul 26, 2008 11:31 pm

Postby richardk » Sun Sep 06, 2009 3:24 pm

What happens when you go to /sale/267-Tools.html?

You have to edit your script so it outputs
Code: Select all
<a href="/sale/267-Tools.html">Tools</a>

What code currently outputs the link?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby pat99 » Sun Sep 06, 2009 10:40 pm

super ! it's working now... I always have trouble understanding how to edit the script...

Thanks Richard

Pat
pat99
 
Posts: 10
Joined: Sat Jul 26, 2008 11:31 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 31 guests

cron