affiliate_link

Sunday, May 11, 2014

Htaccess tips

1. Make all your files extension .htm instead of .php

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.htm$ /$1.php [NC,L] 

2. Remove file extensions. for example www.website.com/page.php will show as www.website.com/page

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ /$1.php [L,QSA]

3. Force File Download
Instead of opening files in the web browser it forces these files types to download

<FilesMatch "\.(mov|mp3|jpg|pdf)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment
</FilesMatch>




Reference: http://wiki.dreamhost.com/Htaccess_tricks

No comments: