Tuesday, 15 April 2014

mod rewrite - RewriteRule a working URI to a new format -



mod rewrite - RewriteRule a working URI to a new format -

i formatting redirect of site url using this. got problem on redirecting properly.

browser link :

http://www.exampledomain.com/1234/user

my project need :

http://www.exampledomain.com/index.php?id=1234&username=user

but don't know how .

rewriterule ^/?([-a-za-z0-9_+]+)$ index.php?id=$1

try this...

rewriteengine on rewritebase / rewriterule ^/?([-a-za-z0-9_+]+)/?([-a-za-z0-9_+]+)/?$ /index.php?id=$1&username=$2

sory:

new correction without / before index.php

rewriterule ^/?([-a-za-z0-9_+]+)/?([-a-za-z0-9_+]+)/?$ index.php?id=$1&username=$2 [l]

and if base of operations url www.domanin.com/folder1/folder2 line be:

rewritebase /folder1/folder2

mod-rewrite

No comments:

Post a Comment