el canadiano
Active member
Recall that the default XenForo's .htaccess looks like this.
Given my domain is https://rockbandforums.com, I want to extend my .htaccess so that it does the following.
Now, here's my issue. I have the following code which satisfies the first two points.
From what I have tested, if I were to place this after XenForo's conditions, this will not work at all. If I place it before, then it will work. However, XenForo's friendly URLs feature (which is currently turned on) will break.
Is there a way where I can rewrite my .htaccess such that it will work with both the friendly URLs and get that to write?
Code:
# Mod_security can interfere with uploading of content such as attachments. If you
# cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
# SecFilterEngine Off
# SecFilterScanPOST Off
#</IfModule>
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks -MultiViews
# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo
# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
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]
</IfModule>
Given my domain is https://rockbandforums.com, I want to extend my .htaccess so that it does the following.
- Redirect http://www.rockbandforums.com to https://rockbandforums.com
- Redirect http://rockbandforums.com to https://rockbandforums.com
- Redirect https://www.rockbandforums.com to https://rockbandforums.com
Now, here's my issue. I have the following code which satisfies the first two points.
Code:
RewriteCond %{HTTP_HOST} !^www\.rockbandforums\.com$
RewriteRule ^(.*)$ https://rockbandforums.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://rockbandforums.com/$1 [R=301,L]
From what I have tested, if I were to place this after XenForo's conditions, this will not work at all. If I place it before, then it will work. However, XenForo's friendly URLs feature (which is currently turned on) will break.
Is there a way where I can rewrite my .htaccess such that it will work with both the friendly URLs and get that to write?