Modrewrite for PHP variables

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

write this in your .htaccess

links are going to look like this

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

its going to work, even if you type

Copy this code and paste it in your HTML
  1. RewriteEngine on
  3. RewriteRule ^admin/?$ admin.php [NC]
  4. RewriteRule ^admin/([^/.]+)/?$ admin.php?action=$1 [NC]
  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


RSS Icon Subscribe to comments

You need to login to post a comment.