Using mod_rewrite for a Christmas frontpage

Posted: December 15th, 2012 | Author: | Filed under: .htaccess, Internet, mod_rewrite, Programming | No Comments »

I needed to add a quick splash to our homepage to give an update on our Christmas opening hours.

I added a quick jQuery pop-up to our index.php, then saved that as index_xmas.php.

Then it’s a simple matter of adding a line to our .htaccess file:

Redirect 302 /index.php http://www.domain.com/index_xmas.php

All requests to index.php are now sent to index_xmas.php.

The “Redirect 302” code tells the browser that the redirect is temporary and that it should continue to use the regular URL.

After Christmas all I have to do is remove that line from the .htaccess to resume normal service.



Leave a Reply