Simple PHP URL ReWritee


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



Copy this code and paste it in your HTML
  1. // HTACCESS FILE
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine on
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteRule .* index.php
  7. </IfModule>
  8.  
  9. // PHP SIDE
  10. <?php
  11. // Base host for the client assets (js, css, image)
  12. $host = dirname($_SERVER["SCRIPT_NAME"])."/";
  13. // Base root for the server side (like for the php inclusion)
  14. $root = dirname(__FILE__)."/";
  15. // Array of arguments passed in the adresse bar
  16. $args = explode("/",str_replace(dirname($_SERVER["SCRIPT_NAME"])."/", "", $_SERVER["REQUEST_URI"]));
  17. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.