Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For all of my devs, I forward all requests to the <code>index.php</code>, I exclude all css, js, jp(e)g, pdf, zip etc.</p> <p><strong>.htaccess</strong></p> <pre><code>DirectoryIndex index.php #ErrorDocument 404 /index.php?page=404 RewriteEngine on RewriteCond %{REQUEST_URI} !\.(.+)$ RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301] RewriteCond %{REQUEST_URI} !\.(ico|docx|php|png|css|jpe?g|js|pdf|txt|mp3)$ RewriteRule ^(.*)$ index.php </code></pre> <p><strong>Then in your PHP boot code</strong>,</p> <p>Setup vars to give content and use <code>$_GET</code> later if you want.... Exemple : </p> <pre><code>&lt;?php function rewrite(){ $link = $_SERVER['REQUEST_URI']; $params = array("base_url", "locale", "page", "action", "par1", "par2", "par3", "par4"); $extraParams = preg_match("/\?/i", $link, $extraParamsMatches); if($extraParams){ $link = explode("?", $link); $link = $link[0]; } $link = explode("/", $link); $i = 0; $vals = array(); foreach($link as $key =&gt; $value){ if($params[$key] == "base_url") $value = $_SERVER['SERVER_NAME']; //if(empty($value)) continue ; $vals[$params[$key]] = $value; if($i == sizeof($params)-1){ break; } $i++; } return $vals; } } ?&gt; </code></pre> <p><strong>IMPORTANT</strong> YOU CAN EDIT THIS CODE TO IMPROVE SECURITY FOR EXAMPLE SANITIZE DATA BEFORE USE IT IN THE FUNCTION ;-) if the requested page is not found physically or in array from php or database, you can send <code>header('Location : ',true, 404);</code> and give your 404 page !!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload