domain.com/news/123 -> domain.com/folder/index.php?news=1

Discuss practical ways rearrange URLs using mod_rewrite.

domain.com/news/123 -> domain.com/folder/index.php?news=1

Postby SGP » Mon Feb 07, 2005 8:37 am

Hi all, is there a way to get what asked in the subject?

to make: domain.com/myfolder/news/123

to

domain.com/myfolder/index.php?news=123

Thanks for your help :)
SGP
 

Postby Caterham » Mon Feb 07, 2005 1:59 pm

Code: Select all
# domain.com/news/123
RewriteRule ^([a-z0-9]+)/([0-9]+)/? /yourfolder/index.php?$1=$2 [L]



Code: Select all
#domain.com/myfolder/news/123

RewriteRule ^yourfolder/([a-z0-9]+)/([0-9]+)/? /yourfolder/index.php?$1=$2 [L]


see also viewtopic.php?p=1618#1618 for n variables
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 41 guests

cron