• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 www redirects to homepage?

#1
I've been searching the forums all day for an answer to this, but can't seem to find it.

My issue: When I type www.example.com/forum/ it redirects to https://example.com.
Interestingly, when I type www.example.com/forum/forums/topic-name.25/, it leads to https://example.com/forums/topic-name.25/.

Any ideas how to fix my .htaccess code?

Code:
    RewriteEngine On
RewriteCond %{HTTP_HOST} www.rickme.com$
RewriteRule ^(.*)$ https://rickme.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 

AndyB

Well-known member
#2
You will need add code to the .htaccess in the web root as well as the forum directory.

web root
Code:
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^www.rickme.com$ [NC]
RewriteRule ^(.*)$ https://rickme.com/$1 [R=301,L]
forum directory (put this code directly below RewriteEngine On)
Code:
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^www.rickme.com$ [NC]
RewriteRule ^(.*)$ https://rickme.com/forum/$1 [R=301,L]
Note: For the .htaccess to take effect, you must clear your cache and exit your browser.
 
Last edited: