There are a wide variety of issues related to URL rewriting. This checklist will help you find the cause.
The type of 404
Open two tabs, enter the following addresses:
1. example.com/admin
2. example.com/does-not-exist
Compare both screens, if 1 matches 2, then rewriting does not work. You are hitting the webserver and not the Flarum installation when requesting the admin area.
If 1 and 2 don't match, please open a discussion under the support tag.
checking mod_rewrite
Do one of the following:
- With ssh run
ls -la /etc/apache2/mods-enabled | grep rewrite
, a result containing rewrite.load
tells you mod_rewrite is enabled.
- Create a file
phpinfo.php
in the Flarum installation, open this in your browser http://example.com/phpinfo.php
and search for mod_rewrite, if you encounter it, mod_rewrite is enabled
If either of these tests indicate mod_rewrite is not enabled, enable it using
sudo a2enmod rewrite
check your .htaccess
Check the Flarum installation directory for a .htaccess
file. If it does not exist, get the latest version here.
check Flarum can override directives
Check the webserver website configuration. For a clean server this can be found at /etc/apache2/sites-enabled/000-default.conf
, make sure it contains:
<Directory "/var/www/html">
AllowOverride All
</Directory>
Please note that you add these lines at the end of the config file for your website configuration file. If more files exists, please check which one mentions your domain name and add the lines there. Don't forget to restart the webserver, eg:
sudo apache2ctl graceful
If your issue is still not solved, please open a discussion under support.