Tech Thought

Tech tips, hints, and general musings. PHP, Perl, Mysql, Javascript, AJAX, JSON, Linux, Mac OSX

Entries Tagged ‘mod_rewrite’

How-To: Redirect all requests to maintenance page with mod_rewrite

A common requirement when performing maintenance on your website is to redirect all requests to a downtime message. This can be very easily achieve using mod_rewrite and a .htaccess file. Simply create an .htaccess file with the following commands: RewriteEngine OnĀ  RewriteRule !^site-down\.html$ /site-down.html [L] This will redirect all requests to the site-down.html file. Once [...]

Leave a Comment

How-To: Redirect one domain to another with mod_rewrite

Recently I needed to change the end of one of our domains from .com to .org. However we wanted to maintain any old links that pointed at the .com domain. Using mod_rewrite you can achieve this move seamlessly for users, and keep all the parameters in tact. Simply add the following lines to your .htaccess [...]

Comments (1)