apache - mod_rewrite, i want to rewrite: index.php?page=contact to contact -
apache - mod_rewrite, i want to rewrite: index.php?page=contact to contact -
i want people using site see site.com/contact in browser address bar in place of site.com/index.php?page=contact.
i'm new mod_rewrite, , far, came rule.
the code have right is:
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?page=$1
how accomplish this?
edit: problem url of contact page still says: site.com/index.php?page=contact.
the lastly part, rewriterule, should this:
rewriterule ^(contact)/?$ index.php?page=$1
that means if user types, "mysite.com/contact" they're beingness served "mysite.com/index.php?page=contact".
the parentheses create capture group, translates $1
. each consecutive parentheses, capture grouping variable increments - $2
, $3
, , on.
apache mod-rewrite url-rewriting
Comments
Post a Comment