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

Something's wrong

Discussion in 'Server Configuration and Hosting' started by gmaister22, May 20, 2013.

  1. gmaister22

    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? :(
     
  2. Lycaon

    Lycaon Well-Known Member

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

    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
     
  4. gmaister22

    gmaister22 Active Member


    That one works too, but it has to be at the very start of the code, it doesnt work at the end...weird...
     
  5. Chris D

    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)
     
  6. gmaister22

    gmaister22 Active Member

    Thanks buddy :) :)
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

  8. gmaister22

    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...
     
  9. Slavik

    Slavik XenForo Moderator Staff Member

    .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.
     
    Lycaon likes this.
  10. gmaister22

    gmaister22 Active Member

    That's something new for me, thanks :)
     

Share This Page