Htaccess redirect all urls except some and exclude my own ip

July 6, 2021 . 1 MIN READ

Yes that looks pretty okay to me.

Two minor suggestions:

  1. Add a $ after the IP RewriteCond. For this example 11.11.11.11, 11.11.11.110, 11.11.11.111, 11.11.11.112, etc would all be valid, but I’m guessing you were going for just allowing 11.11.11.11
  2. Change the $ in the RewriteRule to .? which is slightly faster.

Otherwise the code looks good. And good call with R=302, too :tup:

https://www.sitepoint.com/community/t/htaccess-redirect-all-urls-except-some-and-exclude-my-own-ip/7382/2

Leave a Reply

Your email address will not be published. Required fields are marked *