apache - RewriteRule for nicer URL -
i want redirect queries
www.example.com/mysite/post/3/title-of-the-post
to
www.example.com/mysite/display.php?id=3
by setting .htaccess
file @ root of www.example.com/mysite/
. tried :
.htaccess file --------------- rewriteengine on rewriterule ^post/([0-9]+)/* index.php?id=$1 [l]
why doesn't work? how set rewriterule in situation? need add more lines single line in .htaccess ?
you don't need *
(which should .*
) @ end because you're not ending expression $
. can instead:
rewriterule ^post/([0-9]+)/ index.php?id=$1 [l]
if want close expression, use this:
rewriterule ^post/([0-9]+)/.*$ index.php?id=$1 [l]
Comments
Post a Comment