Web Hosting Talk







View Full Version : rewrite rule needed


partyvibe
10-08-2006, 01:38 AM
Could someone help me to tidy up the following URLs into something more spider friendly?

page.php?do=archive
page.php?do=archive&page=2
page.php?do=archive&page=3

etc...

Thanks!

hugh

Renard Fin
10-08-2006, 01:21 PM
you can do it via 2 ways.

1- without mod_rewrite

code your pages to look at : yoursite.com/page.php/1st-param/2nd-param
look at $_SERVER['REQUEST_URI'] I think to see everything after page.php (not sure but I think it is this var)

2- with mod_rewrite

your page would be yoursite.com/[do=]archive/[page=]2

RewriteRule ([a-zA-Z0-9])/*([0-9]*) page.php?do=$1&page=$2

Should work correctly with both.

astellar
10-09-2006, 05:47 AM
Could someone help me to tidy up the following URLs into something more spider friendly?

Try
/page/arhive.html for page.php?do=archive
/page/arhive_2.html for page.php?do=archive&page=2

Rewrite code:

RewriteRule ^/page/(.*)_(\d+).html page.php?do=$1&page=$2 [NC,L]
RewriteRule ^/page/(.*).html page.php?do==$1 [NC,L]

partyvibe
10-12-2006, 05:12 AM
Thank you both!