![]() |
Languages: |
English |
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.
The procedure for enabling Search Engine Friendly URLs differs depending on the web server you are using. If you are using shared hosting, it is probably Apache. Ask your hosting provider for more information if you are uncertain.
Only the most popular web servers have been included on this page. Visit Enabling Search Engine Friendly (SEF) URLs on IIS and Category:Search Engine Friendly URLs for more articles.
Contents |
These are step-by-step instructions. Please follow them in the order they are presented here. If a step fails, do not continue until you have solved the problem.
"htaccess.txt"
in your Joomla!'s base folder to ".htaccess"
.
.htaccess
in a text editor. Uncomment RewriteBase /
(remove the first character, #). If Joomla is installed in its own folder, the enter the Joomla folder name after the backslash. e.g. RewriteBase /yourjoomlafolder
.
http://www.example.com/index.php/the-news/1-latest-news/1-welcome-to-joomla
.
http://www.example.com/the-news/1-latest-news/1-welcome-to-joomla
.
apache/conf/httpd.conf
, open that file and check if the line LoadModule rewrite_module modules/mod_rewrite.so
is uncommented. If necessary, uncomment the line and restart the Apache web server.
.htaccess
file renamed.
.html
to the end of URLs. There are different opinions on whether this is necessary or even useful. Search engines do not seem to care if your URLs end in .html
or not.
If you have a server running IIS 7 and PHP, you can take advantage of IIS's own internal URL rewriting by using a web.config file similar to the one listed below.
You can create the file yourself or use the GUI in the IIS7 Manager. You can import .htaccess rules using the GUI/wizard.
This functionality depends on the presence of the IIS URL Rewrite Module, which does not come with Windows. It is a free download and a Microsoft product.
If the IIS URL Rewrite module is installed, your website manager will have a tool for "URL Rewrite", visible in the IIS Manager's view of your site's configurable IIS modules. The interface is largely self-explanatory. Regular expressions, wildcards or exact matches are all supported.
In the Joomla config turn on both the SEF and Apache mod_rewrite, next create a rule under IIS URL Rewrite:
This has been tested on Joomla 1.5 with IIS 7 on Windows Server 2008 with no problems so far. For more information on converting .htaccess to web.config, check out http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <clear /> <rule name="Common Exploit Blocking" stopProcessing="true"> <match url="^(.*)$" /> <conditions logicalGrouping="MatchAny"> <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" /> <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" /> <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" /> <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" /> <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" /> </conditions> <action type="Redirect" url="index.php" appendQueryString="false" redirectType="SeeOther" /> </rule> <rule name="Joomla Search Rule" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^/search.php" ignoreCase="true" /> </conditions> <action type="Rewrite" url="/index.php?option=com_content&view=article&id=4" /> </rule> <rule name="Joomla Main Rewrite Rule" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="(/[^.]*|\.(php|html?|feed|pdf|raw))$" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/" /> </rule> </rules> </rewrite> <caching> <profiles> <add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" /> </profiles> </caching> </system.webServer> </configuration>
# Support Clean (aka Search Engine Friendly) URLs</tt> location / { try_files $uri $uri/ /index.php?q=$request_uri; }
http://www.example.com/index.php/the-news/1-latest-news/1-welcome-to-joomla
.
http://www.example.com/the-news/1-latest-news/1-welcome-to-joomla
.
apache/conf/httpd.conf
, open that file and check if the line LoadModule rewrite_module modules/mod_rewrite.so
is uncommented. If necessary, uncomment the line and restart the Apache web server.
.htaccess
file renamed.
.html
to the end of URLs. There are different opinions on whether this is necessary or even useful. Search engines do not seem to care if your URLs end in .html
or not.