Welcome to WebmasterWorld Guest from 34.229.113.106

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

mod_rewrite

Using two back references

     
6:45 pm on Jan 18, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Hello. I've been using mod_rewrite alot for dynamic urls. So far it's been going fine, but now I'm trying to back reference two variables in the url.

Example:

change >> mysite.com/widgets_section/blue_widgets_shop

to >> mysite.com/widgets/shop.php?shop=blue_widgets

_section and _shop are the regular expressions.

I've tried these lines:

RewriteRule ^(.*)_section/(.*)_shop$ /$1/shop.php?shop=$2
RewriteRule ^(.*)_section\/(.*)_shop$ /$1/shop.php?shop=$2
RewriteRule ^\/(.*)_section\/(.*)_shop$ /$1/shop.php?shop=$2

7:01 pm on Jan 18, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


The last post was incorrect. I really wanted to make this change:

mysite.com/widgets_section/blue_widgets_shop

to

mysite.com/shop.php?shop=blue_widgets&section=widgets

I got this line to work :)

RewriteRule ^(.*)_section/(.*)_shop$ /shop.php?shop=$2&section=$1

10:27 pm on Jan 18, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Rats!

Missed all the fun... ;)

Jim