.htaccess - How to rewrite URL to friendly URL? -
i'm working on .htaccess file creating seo friendly urls site. still experimenting , not works far.
i looking make work good.
options +followsymlinks rewriteengine on rewritebase / rewriterule ^([a-za-z0-9-/]+)/$([a-za-z0-9-/]+)/$ ?m=$1&id=$2 [l,qsa,nc]
from:
www.testing.com/?m=bestproduct&id=admin
to:
www.testing.com/bestproduct/admin
from:
www.testing.com/?m=product&id=admin
to:
www.testing.com/product/admin
from:
www.testing.com/?m=company&id=admin
to:
www.testing.com/company/admin
anyone have clue?
i guess you're thinking in wrong way. url rewriting allow : rewritten => original, , not opposite.
your rules good, here's correction :
options +followsymlinks rewriteengine on rewritebase / rewriterule ^([\w-]+)/([\w-]+)/?$ ?m=$1&id=$2 [l]
then, always use rewritten urls in code.
Comments
Post a Comment