Forum Moderators: phranque
2.
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^(.*)$ [123.com...] [R=permanent,L]
So which one is correct?
Be aware that the code you found has a bug. The first two directives are reversed. The code order must be:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.123.com/$1 [R=301,L]
Jim
No, it might mean that in order to avoid the 403-Forbidden error, it is necessary to execute one of your RewriteRules. If neither FollowSymLinks nor SymLinksIfOwnerMatch is enabled, then mod_rewrite is disabled, so your rule does not get executed, and the result is a request for a disallowed file or directory.
> I tried to switch these two lines, no effect. Do I still need to update all my .htaccess files?
No, if it's not broken, don't fix it! I need to remind myself occasionally of a fact about Apache that is not obvious: Directives in .htaccess are not processed in the order that they appear. They are processed in the order that their corresponding modules execute, as set by the server config. This can vary, but the order of execution of some common modules is usually:
mod_setenv
mod_headers
mod_expires
mod_auth
mod_access
mod_rewrite
mod_alias
mod_actions
mod_dir
mod_include
mod_mime
And it appears that core Apache directives (such as 'Options') execute first of all.
Each of these modules takes its turn going through your .htaccess file and executing the directives that it understands. So the order of directives in .htaccess cannot be used to control anything other than the order of execution *among directives processed by the same module*.
Jim