Posted By

frankyfish on 04/12/10


Tagged

url php rewrite


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
345crew


Simple PHP URL ReWritee


 / Published in: PHP
 

  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  

You need to login to post a comment.