help please..... rewriterule problem

Discuss practical ways rearrange URLs using mod_rewrite.

help please..... rewriterule problem

Postby metalmadgear » Mon Nov 07, 2005 11:29 am

i'm not sure how to do this... but this is my problem
i have 3 links that i want to rewrite

http://www.website.com/cgi/sx.cgi?display=home
http://www.website.com/cgi/sx.cgi?action=yes&id=p12
http://www.website.com/cgi/sx.cgi?searc ... ord=sample

i wanted to change them to this

http://www.website.com/cgi/sx.cgi?display=home
to this one >>>>>>>> http://www.website.com/data/home.html

http://www.website.com/cgi/sx.cgi?action=yes&id=p12
to this one >>>>>>>> http://www.website.com/data/p12.html


http://www.website.com/cgi/sx.cgi?searc ... ord=sample
to this one >>>>>>>> http://www.website.com/data/sample.html


this is my code... but doesnt work


RewriteEngine on


RewriteRule ^data/(.*)\.html$ /cgi/sx.cgi?id=$1&action=$2


RewriteRule ^data/(.*)\.html$ /cgi/sx.cgi?display=$1


RewriteRule ^data/(.*)\.html$ /cgi/sx.cgi?keyword=$1&search=$2


your help will be greatly appreciated...
metalmadgear
 
Posts: 4
Joined: Mon Nov 07, 2005 11:14 am

Postby seomike » Mon Nov 07, 2005 12:06 pm

RewriteCond %{REQUEST_URI} /data/home.*
RewriteRule ^data/(.*)\.html$ /cgi/sx.cgi?display=$1 [L]

RewriteCond %{REQUEST_URI} /data/p[0-9]+
RewriteRule ^data/p([0-9]+)\.html$ /cgi/sx.cgi?action=yes&id=p$1 [L]

RewriteCond %{REQUEST_URI} /data/sample.*
RewriteRule ^data/(.*)\.html$ /cgi/sx.cgi?search=yes&keyword=$1 [L]

just make sure you test these :)
seomike
 
Posts: 331
Joined: Thu May 06, 2004 7:36 pm
Location: Dallas

thanks mike

Postby metalmadgear » Mon Nov 07, 2005 12:56 pm

thanks for the help mike.... but the code is not working...

i get error 404... the page cannot be found...

anyways
what does request_uri do? :P
metalmadgear
 
Posts: 4
Joined: Mon Nov 07, 2005 11:14 am

reply

Postby metalmadgear » Wed Nov 09, 2005 7:33 am

any other solutions... help please
metalmadgear
 
Posts: 4
Joined: Mon Nov 07, 2005 11:14 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 2 guests

cron