XF 1.4 URL rewrite help

Zynektic

Well-known member
Hi there,

I know this has been asked a lot (I searched) but want to get an answer before attempting it so nothing breaks if you don't mind lending a hand.

As per Brogan's FAQ I want to stop www. and direct it to http:// as it appears users clicking on the portal and shoutbox links are being taken to a www. page which logs them out so obviously something is not right. I have a portal (which will get replaced tomorrow but can set it up beforehand on board settings set as portal/ in the Index Page Route which shows fine but when you click a link on the portal as mentioned it goes to www and logs the user out (unless they close the tab and on http:// still logged in). I've not edited the .htaccess file so I am asking which would be correct to do this.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    #    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>

Do I need to remove the # from rewritebase and set it to /forum as it goes to this or /thread or anything and below that do I need to remove the # on rewriterule .* and add the following below it...

Code:
RewriteCond %{HTTP_HOST} www.example.com$
RewriteRule ^(.*)$ http://example.com$1 [R=301,L]

I assume I just alter the URL to match my domain if I add the above in or is there any issue causing this?

Thanks!
 
Don't uncomment RewriteBase unless you have problems.

You can add those new rewrite lines immediately under the RewriteEngine On line (adapted to your domain).
 
Back
Top Bottom