Enabling Search Engine Friendly (SEF) URLs on Apache
From Joomla! Documentation
Revision as of 06:33, 9 June 2011 by Mvangeest
<translate> Search engine friendly (SEF), human-readable or clean URLs are URLs that make sense to both humans and search engines because they explain the path to the particular page they point to. Since version 1.5, Joomla! is capable of creating and parsing URLs in any format, including SEF URLs. This does not depend on URL rewriting executed by the web server, so it works even if Joomla! runs a server other than Apache with the mod_rewrite module. The SEF URLs follow a certain fixed pattern, but the user can define a short descriptive text (alias) for each segment of the URL.
Internally, the local part of a SEF URL (the part after the domain name) is called a route. Creating and processing SEF URLs is therefore referred to as routing, and the relevant code is called a router. </translate>
This article addresses SEF URLs under the popular, open-source Apache webserver. SEF URL implementation is possible under Microsoft's IIS webserver as well, please see SEF URLs on IIS.
- Rename htaccess.txt to .htaccess.
- Uncomment "RewriteBase /"
- If Joomla is installed in its own folder, the enter the Joomla folder name after the backslash. e.g. "RewriteBase /yourjoomlafolder"
- Make sure that Mod_rewrite is working. Check that the line shown below in the file "apache/conf/httpd.conf" is uncommented. If necessary, uncomment the line and re-start the Apache web server.
LoadModule rewrite_module modules/mod_rewrite.so
- In Global configuration, set the three SEF options. The action of the three parameters is as follows:
- Search Engine Friendly URLs. Converts the URLs from the native Joomla! format to the SEF format.
- Use Apache mod_rewrite. Uses the Apache "mod_rewrite" function to eliminate the "index.php" portion of the URL. If you don't want to use mod_rewrite, set this to "No" and don't rename the htaccess.txt. The SEF URLs feature will still work. The only difference is that you will see "index.php" in the URL, for example,
- Even if you do not use Apache mod_rewrite you may still rename the htaccess.txt to .htaccess
- Add suffix to URLs. Adds ".html" to the end of URLs.
- Enable 'System - SEF' plugin
- This plugin adds SEF support to links in your Joomla articles. It operates directly on the HTML and does not require a special tag.
If your site does not work correctly after enabling Search Engine Friendly URLs, please see Why does your site get messed up when you turn on SEF (Search Engine Friendly URLs)?
If turning on the Use Apache mod_rewrite option creates errors, please see How to check if mod rewrite is enabled on your server.