1
votes

I am running a Joomla website on an Ubuntu server with apache in a virtual host, but can't get URL rewrite to work(want to remove index.php from URLs).

Mod_rewrite is enabled on the server, tested and working on another non-Joomla virtual host. The two virtual host setups are identical except for different paths/domains and a SSL certificate on the Joomla VH. I can't seem to find anything in the certificate that should cause these problems, but I might be wrong. Any thougts on this?

I have tested the functionality of the rewrite module with Joomla's URL rewrite setting (in global configuration) with the default Joomla .htaccess as well as with an htaccess (rewritebase, commenting out other rewrites etc.). Also tried with an empty .htaccess only adding a standard rewrite rule provided by Joomla! Documentation:

RewriteEngine On<br/>
Options +FollowSymLinks<br />
RewriteRule ^joomla\.html http://www.joomla.org/? [R=301,L]

This it not working either.

Does anyone have an idea of what could be wrong or on how I can troubleshoot this further?

Ubuntu Version: 16.04.1
Apache Version: 2.4.18
PHP Version: 7.0.22
Joomla Version: 3.7.5

1
For troubleshooting, try these possibilities separately. 1. Verify Joomla global configuration showing SEF with rewrite enabled in configuration.php. 2. Comment out the #Options +FollowSymLinks, 3) use a redirect checker website to see if it is detecting anything fishy - YellowWebMonkey
Had already tried the options you provided but your comment made me give it one more go and solution 2 fixed it. Thanks! - Mathias H

1 Answers

2
votes

There are four steps involved if you want to have SEF URL in Joomla on a Ubuntu server with ApacheĀ 2+. Maybe some of them are already done but I want to put all of them here.

I assume you have sudo access to you server, other wise your hosting provider have to do the first two steps.

  1. Enabling mod_rewrite on Apache sudo a2enmod rewrite && sudo systemctl restart apache2

  2. Allowing rewrite for your VirtualHost

    <Directory "/var/www/path/to/public">
        AllowOverride All
    </Directory>
    

    If this step is missing, nothing in your .htaccess file will work. If you have already a Directory-Direktive just only add AllowOverride All You may want to restrict this later but just for testing ALL would be good.

  3. Rename the Joomla htaccess.txt to .htaccess. Usually you don't have to change this file just use the original one and rename it.

  4. Enable SEF in Joomla! Login as Joomla superuser and go to the Joomla System Konfiguraton e.g. http://www.example.com/administrator/index.php?option=com_config. On the right side you have to enable the first two options (SEF URLs and URL-Rewite)

Now you should have SEF URLs without index.php