• 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

Kirk

Well-known member
#1
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>
 

Tracy Perry

Well-known member
#3
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.
 

Kirk

Well-known member
#4
The default htaccess included with XenForo should work.

Can you give more details of the issue?
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.
If you are not running in your root, you may need to enable the
Code:
#RewriteBase /xenforo
changing xenforo to where you have your forum located.
i have it in root.
 

Chris D

XenForo developer
Staff member
#5
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?
 

Tracy Perry

Well-known member
#6
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

Well-known member
#7
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?
Switched to default. The only thing i changed was to make it force https on non www. That's where my problem was.
 

Tracy Perry

Well-known member
#8
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.
 

Kirk

Well-known member
#11
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