mod_rewrite help

  • justice
  • Beginner
  • Beginner
  • justice
  • Posts: 57

Post 3+ Months Ago

Hi,

I've been searching around for some mod_rewrite help. The main one I could see is the Apache documentation, which is not easy to understand.

I was wondering if anyone can give me some ideas about my problem:

I have dynamically produced pages, which I'd like to present as static pages to the search engines (The usual story :P ).

I have already managed to sort out the easy bit of presenting:

http://www.***.com/listing_browse/ToLet/

as

http://www.***.com/listing_browse.php?type[]=ToLet


by using

RewriteRule listing_browse/(.*)/$ /listing_browse.php?type%5B%5D=$1

I also have the following type of pages

http://www.***.com/listing_browse.php?c ... =beds&type[]=ToLet

that I'd like to present as

http://www.***.com/listing_browse/ToLet/3/sortby/beds/


I came up with the following rule but it does not seem to do anything;

RewriteRule listing_browse/(.*)/(.*)/(.*)/(.*)/$ /listing_browse.php?cur_page=$2&$3=$4&type[]=$1


I cannot figure out what I'm missing.

I'd really appreciate if anyone can shed any light on this.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • alien
  • Novice
  • Novice
  • alien
  • Posts: 30

Post 3+ Months Ago

Try this:

RewriteRule ^listing_browse/([0-9A-Za-z]+)/([0-9]+)/([0-9A-Za-z]+)/([0-9A-Za-z]+)/?$ /listing_browse.php?cur_page=$2&$3=$4&type[]=$1
  • justice
  • Beginner
  • Beginner
  • justice
  • Posts: 57

Post 3+ Months Ago

Thanks for your reply Alien.

the problem was the order of my rules. Apparently! it is important which order you have the rules in the .htaccess. I had to swap the places of the following 2 rules.

RewriteRule listing_browse/(.*)/$ /listing_browse.php?type[]=$1

RewriteRule listingview_print/(.*)/(.*)/(.*)/(.*)/(.*)/$ /listingview_print.php?$2=$3&$4=$5&type[]=$1

The owner of the http://mod-rewrite.com/ forum was very helpful.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 5 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.