.htaccess examples

Submitted by Anonymous (not verified) on Wed, 06/10/2009 - 01:40

redirect url with parameters


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} url_get_parameter_1=(.*)&url_get_parameter_2=(.*)
RewriteRule ^your/old/directory/file$ your/new/path/%1/%2 [R=301,L]

This code redirects :

example.com/your/old/directory/file?url_get_parameter_1=ALBUMS&url_get_parameter_2=HOLIDAY

to

example.com/your/new/path/ALBUMS/HOLIDAY

Force files to download (not be displayed in client/browser)

AddType application/octet-stream .pdf .doc .docx .mov .avi .mpg .zip .rar

Add new comment