Redirection htaccess


Considering that you want to have nice URLs that are SEO optimized, you would have to pass parameters without using “?”. In this case we can use redirection htaccess. To make simple example, see snippet below:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1

Use redirection htaccess:

This redirection snippet will work very well if you have a smaller website, where you have smaller frame written inside of index.php, and you are including some page, by page name. You just need a PHP script that will include this file:

include('/pages/' . $_GET['page'] . '.php');

So, by using snippets shown, you will be able to have nice URLs on your website lile:

Security notice on redirection htaccess

Users can trick you by sending URL request like “” therefore you should take care of input you are getting through param “page”.