Sunday, 15 April 2012

php - mod_rewrite for URL with two URL-parameters -



php - mod_rewrite for URL with two URL-parameters -

i want able open next url

http://example.com/login/12345

and in background, should load:

http://example.com/index.php?endpoint=login&access_key=12345

obviously, have tried many htaccess generators create appropriate rewriterule set.

for illustration next (from: http://www.generateit.net/mod-rewrite/index.php):

rewriteengine on rewriterule ^([^/]*)/([^/]*)$ /index.php?endpoint=$1&access_key=$2 [l]

even though know fact .htaccess , mod_rewrite enabled on server (i tried setup test redirect requests example.com example2.com using htaccess , mod_rewrite, , worked), can't work.

i have spent 2 hours find solution on stackoverflow , other websites, attempts failed.

i hope can help me find out right way rewrite url in above example.like explained above.

thanks lot in advance!

try this:

rewriteengine on rewriterule ^([^\/]*)/([^\/]*)$ /index.php?endpoint=$1&access_key=$2 [l] #-added-these---^--------^

when tested, here result:

php .htaccess mod-rewrite

No comments:

Post a Comment