Tech Thought

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

Entries Tagged ‘apache’

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: Fix “command not in docroot” suexec apache error

If you’re in the process of setting up a new server, and you want users to have the ability to execute scripts in their home directory:
http://myserver.com/~myname
You will often run into problems with suexec. suexec is an apache security construct to stop users from executing scripts outside of a known path.
I was recieving the following [...]

Comments (1)

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 [...]

Comments (1)

How-To: htaccess - Require a password for some IPs, not others

The following is a really useful .htaccess configuration options to allow certain IP address to access a site without a password, while requiring everyone else to enter a password:
AuthName “My Secret Page Here”
AuthUserFile /sites/apache-passwords
AuthType Basic
Require valid-user
Order deny,allow
Deny from all
Allow from 171.231.12.8
Satisfy Any

Some really handy examples are available here too.

Leave a Comment

Best Free Mac OS X Applications

Recently I upgraded to a new Mac. I like to install applications from scratch when I upgrade, as it allows me to clean out all the garbage that I didn’t need in the first place. So I’ve compiled a list of all the best free applications I like to have installed on my [...]

Comments (1)