Closed rgvy closed 7 years ago
Excellent catch once again – thank you and sorry for the delay!
So far, the custom rules (including the www
and https
redirects) have only been invoked when the path component of the URL had a length of zero or one, i.e. if the path was either completely empty or if it consisted of a single slash only. Whenever you requested a non-empty path (e.g. /css/styles.css
), the routing would somehow prevent the custom rules from working, as you said.
The fix is more or less what you did, perhaps the inverse. The directives for the routing part have just been moved to the very bottom: https://github.com/delight-im/PHP-Foundation/commit/c8aece33fa480c3c847d782e5a247cbec6ffef10 This should be equivalent to your solution, so just keep what you prefer. No regressions were found in any tests so far with this fix. I hope that remains true.
Thanks!
Moving the router to the end makes more sense. Now I can move my custom Bad Robot User Agent blockers to the custom section.
Hello
Just found an issue in the default .htaccess implementation:
Using the Custom rules to force https and www do not function if placed below the Routing rules. I'm barely know .htaccess, but It seems that the [L] tag prevents those rules from firing. So routing via index.php prevents the Custom rules from working.
I resolved this by moving those rules above the Routing section.