I\'m trying to do clean URLs by exploding $_SERVER[\'REQUEST_URI\']
and then switching between the results.
However, once a user goes outside inde
You will need images, and other files what will show up in the index.php.
RewriteEngine On
Turns on the Rewite Engine
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
If the filename is not equal JPG, JPEG... which need for index.php
RewriteRule ^(.*)$ index.php?q=$1 [QSA]
"Redirect" to index.php.
In use:
With PHP $_GET
the q
will give you the /articles/1987/12/20/Répa's birthday/
If you split the variable in every slash with
list($type, $date_year, $date_month, $date_day, $title) = split('[/-]', $_GET['q']);
You will got exactly what you want.
.htaccess:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?param=$1 [QSA,L]
You can use Apache's mod_rewrite to map URLs based on regular expressions, including sending everything to index.php
,