Posted By

aeboi80 on 07/05/10


Tagged

modrewrite htaccess


Versions (?)

mod_rewrite Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz


 / Published in: HTML
 

  1. Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
  2. If you type http://zorpia.com/roshanbh233 in browser you can see a profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.
  3. RewriteEngine On
  4. RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
  5. RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

Report this snippet  

You need to login to post a comment.