Trouble rewriting

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Guest » Tue Apr 09, 2002 10:08 am

Now i have this:
/album.cfm?album=oudejaar2001&nummer=2

I want it to be:
/album/oudejaar2001/2/

If the user types in /album his adresbar should have to change to /album/ and get redirected to album.cfm
Same with /album/oudejaar2001. Adresbar to /album/oudejaar2001/ and redirected to album.cfm?album=oudejaar2001.
Guest
 

Postby Brett » Sat Apr 13, 2002 1:09 pm

Try this:

RewriteEngine on
RewriteRule ^album$ /album/ [R]
RewriteRule ^album/$ /album.cfm [L]
RewriteRule ^album/([a-zA-Z0-9]+)$ /album/$1/ [R]
RewriteRule ^album/([a-zA-Z0-9]+)/$ /album.cfm?album=$1 [L]
RewriteRule ^album/([a-zA-Z0-9]+)/([0-9])$ /album/$1/$2/ [R]
RewriteRule ^album/([a-zA-Z0-9]+)/([0-9])/$ /album.cfm?album=$1&number=$2 [L]
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest

cron