rewrite using only numeric vars?

Discuss practical ways rearrange URLs using mod_rewrite.

rewrite using only numeric vars?

Postby nitr0z » Fri Jan 28, 2005 7:06 am

Hi

I have the following rule:

RewriteRule ^wordtraffic/([^/]+)/$ /wordtraffic/wordtraffic.php [L]

which currently writes requests to pages such as /wordtraffic/4/ to /wordtraffic/wordtraffic.php (which then grabs the page value from the url and displays the correct page), along with some other rules after this i dont think are related.

What i would like is for all /dir/number/ urls to be written to /dir/dir.php so i can process the page number there.

Any ideas how i can do this?

Thanks in advance.

James Adams
www.nitr0z.com
nitr0z
 

Postby Caterham » Fri Jan 28, 2005 8:39 am

/dir/number/ urls to be written to /dir/dir.php
I think it should be
Code: Select all
RewriteRule ^([a-z0-9]+)/([0-9]+)/?$ /$1/$1.php [NC,L]


Bob
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 23 guests

cron