Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

Apache mod_rewrite - Conditional ReWrites using RewriteCond

The mod_rewrite Apache module can be used on a web server to dynamically change the web page returned to the end user. It has a number of potential uses including: creating user friendly urls to hide complex backend software pages; redirecting from old web pages when a site is redesigned; redirecting to a completely different website (eg. used by the url shortening sites such as tinyurl.com); or sending visitors to different pages depending upon their IP address / region / browser.

I've been using mod_rewrite on my websites for many years, but with a few exceptions the rules I used were fairly basic. I've now found that I wanted to extend the features I use and have therefore looked at RewriteCond rules a bit more.

I've expanded my Apache Mod_Rewrite tutorial to explain how Rewrite Rule Conditions can be used to increase the power of mod_rewrite.