XF 1.4 Redirect from folder to root without www and with https

Luis

Well-known member
Hi all,

I would change my XenForo from one folder to the root, redirecting all links to the root without the www and with https.

I have been looking for information about this here in XenForo and I think I've found all the information necessary to perform this, but I'd like someone to confirm that I'm going to use it right.

This is what I'm going to put in my htaccess:
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 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On
   
    #Redirect from a folder to the root.
    Redirect 301 /foro/ http://www.midominio.com
   
    #Redirect all links from the folder to the root
    RewriteRule ^foro/(.*)?$ /$1 [R=301,L]
   
    ##Redirect from www to without the www - Redirect from http://www.midominio.com to http://midominio.com
    RewriteCond %{HTTP_HOST} ^www\.midominio\.com [NC]
    RewriteRule ^(.*)$ http://midominio.com/$1 [L,R=301]
   
    #Redirect from http to https - Redirect from http://midominio.com to https://dominio.com
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://midominio.com/$1 [R,L]
   
    #    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>

Regards, Luis.
 
I would change my XenForo from one folder to the root, redirecting all links to the root without the www and with https.

Add this to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteRule ^foro/(.*)$ https://midominio.com/$1 [R=301,L]

That will redirect all old /foro links to the root with https and without www.
 
Top Bottom