Something's wrong

gmaister22

Active member
Hey there

Something is wrong ever since i converted from IPB to xF (yesterday)

I go to http://domain.com, login and everything is fine
Then i go to http://www.domain.com and boom, what the heck? I'm not logged in. It's like 2 different sites.

I had a 301 permanent redirection of http://domain.com to http://www.domain.com, it's not working.

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
 
    #    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) - [NC,L]
      RewriteRule (robots\.txt)$ robots.php [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
RewriteEngine On
 
RewriteCond %{HTTP_HOST} ^razeflux\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.razeflux\.com$
RewriteRule ^/?$ "http\:\/\/www\.razeflux\.com\/" [R=301,L]

What is wrong there? :(
 

Lycaon

Well-known member
Try this;
Code:
RewriteCond %{HTTP_HOST} ^www.razeflux.com [NC]
RewriteRule ^(.*)$ http://razeflux.com/$1 [L,R=301]
 

gmaister22

Active member
Changed it to
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

RewriteCond %{HTTP_HOST} ^razeflux\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.razeflux\.com$
RewriteRule ^/?$ "http\:\/\/www\.razeflux\.com\/" [R=301,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) - [NC,L]
      RewriteRule (robots\.txt)$ robots.php [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
And it works....any ideas why? lol
 

Chris D

XenForo developer
Staff member
I'm no expert but you're redeclaring the line "Rewrite Engine On" and placing it after the IF condition that checks if the rewrite module is enabled. I imagine due to one or both of those issues it's being ignored.

Glad it's working for you now (y)
 

gmaister22

Active member
I'm no expert but you're redeclaring the line "Rewrite Engine On" and placing it after the IF condition that checks if the rewrite module is enabled. I imagine due to one or both of those issues it's being ignored.

Glad it's working for you now (y)
Thanks buddy :) :)
 

gmaister22

Active member
Yeah, i knew what code to use to redirect it, but apparently didn't know that positioning is important for it to work...
 

Slavik

XenForo moderator
Staff member
Yeah, i knew what code to use to redirect it, but apparently didn't know that positioning is important for it to work...
.htaccess rules and rewrites are handled in the order they are read. So the first rules need to be at the top to be read first.
 
Top