Mod Rewrite - Different view on exceptions
July 23rd, 2008 Posted in General | 1 Comment »Dear readers,
In my previous post I’ve mentioned how to make an exception through using a different extension. This seemed insufficient to me because I wanted to have a whole directory being excluded from the rewrite URL.
First lets see what I had done so far:
DirectoryIndex index.php
RewriteEngine on
RewriteRule !\.(gif|jpg|js|png|css)$ index.php
This piece of code makes all traffic load index.php. With a piece of php code found in my previous post you could then analyse the URL and use those values instead of $_GET. Using this method makes your URLS more nice to see. You could for example let people go to www.domain.com/browser , do some code in index.php so the browser.php page will be included.
To add exceptions so if you want to access another page not through index.php, you could use a different extension and add it to the rewriterule, but using these lines is way more easy for you.
Read the rest of this entry »