XF 1.5 After importing backup, Friendly Links no longer work

mauzao9

Well-known member
Hello there,

After re-installing my machine and installing everything again, i am with one issue i'm not figuring out easily.

Friendly links had stop working, this with mod rewrite enabled and such (loading correctly on phpinfo). For some reason the .htaccess file had not copy inside the backup correctly so now i'm a bit lost how to put this back correctly again.

I placed a default one however the issue persists, ideas?
 
Hello there,

After re-installing my machine and installing everything again, i am with one issue i'm not figuring out easily.

Friendly links had stop working, this with mod rewrite enabled and such (loading correctly on phpinfo). For some reason the .htaccess file had not copy inside the backup correctly so now i'm a bit lost how to put this back correctly again.

I placed a default one however the issue persists, ideas?
Possible causes of friendly URLs not working (usually manifests as "404 not found" error on forum pages):

1) The .htaccess file is not in place in your forum directory.

2) Sometimes you need to specify RewriteBase in your .htaccess file (specify the name of your forum directory):

RewriteBase /xenforo

3) Your server doesn't have mod_rewrite installed. Consult with your host about this.

4) Your server doesn't have AllowOverride enabled:

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

Consult with your host about this.
 
1) The .htaccess file is not in place in your forum directory.
2) Sometimes you need to specify RewriteBase in your .htaccess file (specify the name of your forum directory):

RewriteBase /xenforo
I have placed the default .htaccess that comes with XF; also removed comment from RewriteBase with right path still returns 404 everywhere.

3) Your server doesn't have mod_rewrite installed. Consult with your host about this.
mod_rewrite is a loaded module on info.php as i can check so the problem is not there.


4) Your server doesn't have AllowOverride enabled:

On my config /etc/apache2/sites-enabled/000-default.conf:
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

That should enable AllowOverride. However still facing 404 on every page expect index.

Other ideas?
 
Any help on this? I have been through this 2 times before, there's something missing that makes friendly links working on a clean LAMP (php7) linux install i can't remember. =/
 
Okay far i can update, i am using SSL now, so https, what i can tell is:

Site works if i go through www., without http/s or it will redirect to https and then any friendly URL will be a 404 error, how can i make it compatible?

There's a lack of documentation and info on this matter of HTTPS and the friendly URLs that seem not working with default config, should i send a ticket?
 
Last edited:
That would really just point to a server misconfiguration. If it works at one URL, then some other path is being hit to cause it to not work at another. If it's 404ing (assuming a non-XF 404), then it's not even getting to XF which points to the rewrite rules not working or being triggered.

There's some discussion of how to test if your .htaccess is being loaded here: http://stackoverflow.com/questions/7137104/check-allowoverride-value-using-php
 
What would be a right example of a .htaccess working correctly for https? Or does the default one cover that?
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 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]

<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 /

    #    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>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType text/html "access 1 week"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 week"
</IfModule>
## EXPIRES CACHING ##
This is what I was using at one time without any issues. Not claiming to be an expert but it worked to redirect my http traffic to https and friendly urls were working as well. Hope it helps.
 
This is what I was using at one time without any issues. Not claiming to be an expert but it worked to redirect my http traffic to https and friendly urls were working as well. Hope it helps.

No problem, this was kinda annoying when i disabled the certificate people couldn't access the website because it was still caching stuff, this is, redirecting them to HTTPS and returning just an error page. It seems that cache ignores any htaccess rule i could place to force the redirect to HTTP again after the former was already cached.

Oh adventures!
 
... It seems that cache ignores any htaccess rule i could place to force the redirect to HTTP again after the former was already cached.
I think I might have misunderstood your intention..are you trying to force all traffic to http and not https? If so then yeah disregard what I wrote as it will do the opposite.
 
I think I might have misunderstood your intention..are you trying to force all traffic to http and not https? If so then yeah disregard what I wrote as it will do the opposite.
I did so as the site had broken because HTTPS i removed it for now until i fix any configuration that might have not worked. However the users who got HTTPS cached still load into that generating error on their side, .htaccess seem to be unable to overlap that.
 
Top Bottom