You would add something like this to your Apache Post VirtualHost include...
Code:
<IfModule mod_rewrite.c>
<Directory "/home/XXXyoursitedirectoryhereXXX/public_html">
Options -Indexes
AllowOverride None
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Force www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [E=HTTPS,R=301,L]
# XenForo
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</Directory>
</IfModule>
If you have XenForo in a subdirectory like /community it would look like this:
Code:
<IfModule mod_rewrite.c>
<Directory "/home/XXXyoursitedirectoryhereXXX/public_html">
Options -Indexes
AllowOverride None
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Force www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [E=HTTPS,R=301,L]
</Directory>
<Directory "/home/XXXyoursitedirectoryhereXXX/public_html/community">
RewriteEngine On
# XenForo
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</Directory>
</IfModule>
Make changes as necessary for your specific installation. Your custom rules will go right above the line starting with "# XenForo". Once this is in place and working well, you can delete your .htaccess files from the directory structure they are now completely ignored. Your redirects will now be cached by the server and you have eliminated the performance loss from Apache AllowOverride.