Modrewrite for PHP variables


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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

You need to login to post a comment.