htaccess rewrite

source: http://www.castlecops.com/postp609971.html

I am not sure that it makes any real difference but I do not put my rewrite conditions inside the <limit> tags. They work quite well just by themselves.

If you are going to work with multiple conditions that all use the same rule you can stack the conditions only. Try:

RewriteEngine On
RewriteCond %{REMOTE_ADDR} 69.144.142.59 [OR]
RewriteCond %{REMOTE_ADDR} 61.149.20. [OR]
RewriteCond %{REMOTE_ADDR} 61.49.147.
RewriteRule ^.*$ http://127.0.0.1 [L]

This will allow you to perform the same rule for a number of conditions.

The neatest thing that I ever did with mod_rewrite came as part of a conversion from phpBB to phpNuke. After importing the old SQL tables and getting the boards running under Nuke I had the problem of existing links on a lot of boards still pointing to the old phpBB forums. I wrote a series of rules that intercepted queries to the old code and rewrote them into the corresponding queries for the new.