Multiple Variables?

Discuss practical ways rearrange URLs using mod_rewrite.

Multiple Variables?

Postby :-) » Sat Jan 22, 2005 7:32 am

Hello.

I'm trying to get links that look like this:

http://t.domain.com/?t=hw&s=L&n=%n

to look like

http://t.domain.com/hw/L/%n


where hw, L, and %n are dynamic.

Having a tough tough time, and the tutorials on the net (at least the ones I've found) have been little help.

Any help would be appreciative.
:-)
 

Postby Caterham » Sat Jan 22, 2005 9:13 am

Note, that http//t.domain.com/hw/L/%n might cause a 400 bad request with some browsers (because no escapint takes place) - you've to escape the % into %25 --> %25n


From http://t.domain.com/hw/L/%25n to http://t.domain.com/?t=hw&s=L&n=%n



.htaccess wrote:
Code: Select all
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /?t=$1&s=$2&n=$3 [NE,L]


Bob
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby :-) » Sat Jan 22, 2005 12:18 pm

I'm sorry, but that did not work.

I should clarify though, %n is actually a placeholder for a screenname, and screennames are alphanumeric, both capital and lower case letters.

I hope that helps.
:-)
 

Postby Caterham » Sun Jan 23, 2005 10:21 am

Did you switch the RW Engine to on with

Code: Select all
RewriteEngine On
above of all rules?
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 63 guests

cron