XenForo SEO Friendly URL returns 404 on forum page

XenForo SEO Friendly URL returns 404 on forum page - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about seo, htaccess, apache, ubuntu, .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :


I have my .htaccess file in the base directory of the installation of XenForo. When I enable SEO Friendly URLs, it returns error 404 only on the forums and members pages.



htaccess file:



#   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

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


when looking at the links when SEO Friendly URLs is enabled/disabled the index.php? is gone, which it's supposed to do but it can't seem to find the forums...


Solution :


Apparently not, no error whatsoever.




It seems that .htaccess files are not allowed/enabled on your server, since adding some random text to the file produces no error. (You would expect to see a 500 Internal Server Error otherwise.)



You need to set AllowOverride All (or something more restrictive like AllowOverride FileInfo - enough for mod_rewrite) in your server config (<Directory> container) that covers the document root directory.



However, if you have access to the server config then you can do all of this in the server config and not use .htaccess at all (recommended).



Reference:

https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride






UPDATE: And then if it's still not working, repeat the checks as mentioned in comments above:




  • Is mod_rewrite enabled? Remove the <IfModule mod_rewrite.c> wrapper - do you get an error? If mod_rewrite is not enabled then expect to see a 500 Internal Server Error (your error log should contain the specific details of the error). You need to enable mod_rewrite and restart Apache.

  • Is FollowSymLinks (or SymLimksIfOwnerMatch) enabled? This is required for mod_rewrite to work. Add Options +FollowSymLinks at the top of your .htaccess file.



If you are still seeing an Apache generated 404 message then then "something else" is going on, since the URL is not being rewritten. (Your .htaccess file looks "OK".)



If you are seeing a 404 generated from your framework (XenForo) then the problem is with your application.


Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect