Clean/SEF URLs Error
User Manual » Troubleshooting » Clean/SEF URLs Error
The above error (Clean/SEF URLs) upon installation suggests that there is a problem with your web server (eg, Apache) parsing the '.htaccess' file mod_rewrite rules. This means your web server will not be able to rewrite the 'clean' URLs (eg, install/stage/one) to the main 'index.php' file of TangoCMS, and will instead attempt to load the directory 'install/stage/one'.
Note: TangoCMS does have Apache module 'mod_rewrite' detection, which will revert to the 'standard' router type (normal URLs) if the module 'mod_rewrite' is not enabled. For this to work, PHP must be running as a module to Apache.
There are a few reasons why you will be getting this error:
- Apache module 'mod_rewrite' is not installed or enabled.
- You have forgotten to upload the '.htaccess' file. This is the most common reason since it is a hidden file on majority of Operating Systems (not Windows).
- Your Apache configuration is not setup to allow for the mod_rewrite rules to be applied.
- You're not using Apache and so the rewrite rules provided wont work.
Failsafe router type
If you are unable to resolve the 'Clean/SEF URLs' error using any of the methods below, then you will have to change the 'router' type to the failsafe 'standard'. To do this, edit the file 'config/default/config.ini.php' and find the following lines (around line 45):
url_router type = sef
Replace the 'type' to 'standard' instead of 'sef', it should now read:
url_router type = standard
Once this is done, the URL structure should now change and you will be able to use TangoCMS without the SEF (Search Engine Friendly) URLs.
Installing and Enabling Apache 'mod_rewrite'
To install the Apache module 'mod_rewrite' you will need to install the package (for Debian/Ubuntu) 'apache2.2-common', which is easily done with the tool 'apt-get' as shown below. (You can skip this part if it's already installed)
sudo apt-get install apache2.2-common
Once the package is installed, it will then need to be enabled using the tool 'a2enmod'
sudo a2enmod rewrite
The module should now be enabled (shown by the message 'Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.') and Apache will need to be restarted for the module to be loaded. Doing as the message says, use the following to restart Apache:
sudo /etc/init.d/apache2 force-reload
Configuring Apache to allow for the 'rewrite' rules
If still after installing the Apache module 'mod_rewrite' you are still getting the Clean/SEF URL's error then the problem could be due to your Apache configuration. Open up your configuration file (for example /etc/apache2/apache2.conf or /etc/apache2/sites-available/default) and find the 'AllowOverride' directive then make sure it is set to 'All', so for example:
AllowOverride +All
As you've made a change to the Apache configuration, you must now restart Apache for the changes to take effect.
sudo /etc/init.d/apache2 restart
Lighttpd
If you are using lighttpd, you will need to do some additional configuration. In your lighttpd configuration file, add the following:
url.rewrite-once = (
"^/install/themes/(.*)$" => "$0",
"^/tmp/(.*)$" => "$0",
"^/html/(.*)$" => "$0",
"^/favicon\.png$" => "$0",
"^/robots\.txt$" => "$0",
"^/install/(.*)$" => "/install/index.php?url=$1",
"^/(.*)$" => "/index.php?url=$1"
)
If you have multiple websites running from lighttpd, or want to run TangoCMS in a subdirectory, you will need to change the rules. Say for example you want to run TangoCMS on the domain foo.example.com, in the sub directory tcm. You would use:
$HTTP"host" == "foo.example.com" { url.rewrite-once = ( "^/tcm/install/themes/(.*)$" => "$0", "^/tcm/tmp/(.*)$" => "$0", "^/tcm/html/(.*)$" => "$0", "^/tcm/favicon\.png$" => "$0", "^/tcm/robots\.txt$" => "$0", "^/tcm/install/(.*)$" => "/tcm/install/index.php?url=$1", "^/tcm/(.*)$" => "/tcm/index.php?url=$1" ) }
Notice that you add /tcm to everything except the $0 values. If you add /tcm to these, the rewrite rules will not work, and will cause your TangoCMS installation not to work.