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

XF 1.3 Friendly Url problem

Discussion in 'Troubleshooting and Problems' started by Kirk, May 11, 2014.

  1. Kirk

    Kirk Well-Known Member

    Hi everyone,

    So i have a problem with the friendly urls. I have it enabled and im new to using htaccess :/. I've provided my htaccess down below. Could someone tell me if i did something wrong?

    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 %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://afterschoollesson.com/$1 [R,L]
    
        RewriteCond %{HTTP_HOST} !^www\.afterschoollesson\.com$
        RewriteRule ^(.*)$ https://afterschoollesson.com/$1 [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|robots\.txt) - [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    
    
    </IfModule>
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    The default htaccess included with XenForo should work.

    Can you give more details of the issue?
     
  3. Tracy Perry

    Tracy Perry Well-Known Member

    If you are not running in your root web folder, you may need to enable the
    Code:
    #RewriteBase /xenforo
    changing xenforo to where you have your forum located.
     
  4. Kirk

    Kirk Well-Known Member

    Well right now the problem is when i click on resources or members or contact or any links in general it gives me a 404 error.
    i have it in root.
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    Is that the default XF htaccess? If not what changes have you made? Have you tried the default one?

    Does Apache have mod_rewrite enabled?
     
  6. Tracy Perry

    Tracy Perry Well-Known Member

    Ahhh... I see you are using OLS.
    Try this
    Code:
    RewriteRule ^(.*)$ http://servinglinux.com/$1 [R=301,L]
    RewriteCond %{HTTPS} !on
    RewriteRule ^(.*)$ https://servinglinux.com%{REQUEST_URI} [R,L]
    
    
    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]
    and changing the servinglinux.com to your FQDN. This is set up to use Rigel's sitemap add-on also. It also forces all inbound to secure connection.
     
    Kirk likes this.
  7. Kirk

    Kirk Well-Known Member

    Switched to default. The only thing i changed was to make it force https on non www. That's where my problem was.
     
  8. Tracy Perry

    Tracy Perry Well-Known Member

    Are you using OLS (which has the rewrites defined in the vhost) or actually using LiteSpeed? If litespeed, the above should still work in your htaccess.
     
  9. Kirk

    Kirk Well-Known Member

    I am using LightSpeed.
     
  10. Tracy Perry

    Tracy Perry Well-Known Member

    That example I gave works for OLS - so I don't know why it wouldn't for LiteSpeed also.
    It works for all 3 forums I have running under OpenLiteSpeed.

    EDIT:
    Looks like it's working now.
     
  11. Kirk

    Kirk Well-Known Member

    When i tried using your snippet of code you provided I of course changed it to my url but when i tried loading my site i got a loop back error :/

    edit:
    When i try going to my site afterschoollesson.com it redirects me to https://afterschoollesson.com and when i try refreshing it takes me to afterschoollesson.com
     
  12. Tracy Perry

    Tracy Perry Well-Known Member

    There may be some differences in LiteSpeed then. It's working on my OLS for my Linux, motorcycle and Apple sites.
     
  13. Kirk

    Kirk Well-Known Member

    Fixed it :D
    I commented out
    #RewriteRule ^(.*)$ https://afterschoollesson.com/$1 [R=301,L]
    and it works now :) Thanks Chris and Tracy! You guys rock.
     
    Tracy Perry likes this.

Share This Page