regex - Regular Expression for Mod rewrite via HTACCESS -


i need regular expression can use in htaccess file rewrite:

http://www.sample.com/dir/1-2-3.php

1 = lower case letters only, no limit on how many

2 = alpha numeric (lower case letters only) , dashes, no limit on how many characters

3 = alpha numeric (upper case letters only), no limit on how many characters

(note: dashes between 1, 2, 3 intentional, , present in url)

to

http://www.sample.com/dir/sub/page.php?v=abc12345

where abc12345 #3 original url.

if i'm understanding correctly, following should work.

rewriteengine on rewriterule ^([a-z]*)-([a-z0-9-]*)-([a-z0-9]*)\.php /$1/$2.php?v=$3 [l] 

hope helps.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -