Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Redirect to include all pages in a directory


lucy24 - 3:18 am on Jan 14, 2013 (gmt 0)


RewriteCond %{TIME_WDAY} 0
RewriteRule ^(AutoIndex)($|/) - [L]
RewriteRule !^503\.shtml$ - [R=503,L]


Is that a direct cut & paste? It would make more sense to use g1's approach and change Rule 1 into a second Condition and have both of them apply to Rule 2, which now becomes your only rule:

RewriteCond %{TIME_WDAY} 0
RewriteCond %{REQUEST_URI} !^/AutoIndex
RewriteRule !^503\.shtml$ - [R=503,L]


You may not need anchors on AutoIndex at all. But opening anchors tend to save time because the server doesn't have to read the whole request. If it doesn't start with /AutoIndex, that's it. Finished. Closing anchors depend on whether you have, or might later get, directories named /AutoIndexSomething else.

If it's in a Condition rather than a rule, doesn't the Request URI need a leading slash? (I detoured to double-check on an existing rule of my own. This also confirms that the "I'm sorry, but the server thinks you are a robot" page works correctly :))

Reminder: Always put a space before each Rule. Among other reasons, it makes it easier to remember that the Conditions only apply to the immediately following Rule, not the whole package.

Special dispensation to omit space if you've got a group of closely related, conditionless rules.


Thread source:: http://www.webmasterworld.com/apache/4475886.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com