Posted By

antpaw on 08/25/08


Tagged

php xhtml htaccess webserver


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
laurentzziu


Modrewrite for PHP variables


 / Published in: PHP
 

write this in your .htaccess

links are going to look like this

yourpage.de/yourVariableValue1/yourVariableValue2/

[NC] will remove the case sensitivity of your static words like "admin"

its going to work, even if you type

yourpage.de/adMIN

  1. RewriteEngine on
  2.  
  3. RewriteRule ^admin/?$ admin.php [NC]
  4. RewriteRule ^admin/([^/.]+)/?$ admin.php?action=$1 [NC]
  5.  
  6.  
  7. RewriteRule ^([^/.]+)/?$ index.php?a=$1 [L]
  8. RewriteRule ^([^/.]+)/([^/.]+)/?$ index.php?a=$1&b=$2 [L]
  9. RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ index.php?a=$1&b=$2&c=$3 [L]

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: kirkstrobeck on November 12, 2008

Real good stuff. I didn't use the admin part, but lines 1, 7, and 8 were great. Thanks.

RewriteEngine On RewriteRule ^([^/.]+)/?$ ?a=$1 [L] RewriteRule ^([^/.]+)/([^/.]+)/?$ ?a=$1&fancy=$2 [L]

You need to login to post a comment.