Difference between revisions of "Enabling Search Engine Friendly (SEF) URLs on Apache"

From Joomla! Documentation

m (Added category)
m (Made miscellaneous improvements)
Line 1: Line 1:
This article addresses SEF URLs under the popular, open-source Apache webserver.
+
{{:Search Engine Friendly URLs}}
 +
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]].
  
SEF URL implementation is possible under Microsoft's IIS webserver as well, please see [[IIS and Joomla]].
+
{{JVer|1.6}} In Joomla! 1.6, basic SEF urls are enabled by default.
  
{{JVer|1.6}} In Joomla! 1.6 basic SEF urls are enabled by default.
 
 
{{JVer|1.5}} In prior versions you need to use the Global Configuration to enable them. The instructions below still apply if you want to use Apache's mod_rewrite.
 
{{JVer|1.5}} In prior versions you need to use the Global Configuration to enable them. The instructions below still apply if you want to use Apache's mod_rewrite.
  

Revision as of 07:28, 9 June 2011

<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 on 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.

Joomla 1.6 In Joomla! 1.6, basic SEF urls are enabled by default.

Joomla 1.5 In prior versions you need to use the Global Configuration to enable them. The instructions below still apply if you want to use Apache's mod_rewrite.

Apache Instructions[edit]

  1. 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"
  2. 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
  3. 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, http://www.yoursite.org/index.php/faq.html.
      • 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.
  4. 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.


See also Why does your site get messed up when you turn on SEF (Search Engine Friendly URLs)?

If No Avail please see How to check if mod rewrite is enabled on your server


COMMENT:

I believe the following are among the most common possibilities for how URLs look in Joomla 1.5 or 1.6. Someone who knows better please confirm if the below is true:

non-SEF (Joomla 1.5 default): http://www.yoursite.org/8-category/7-alias
This is typical of the easiest Non-SEF URLs to understand. See SEF Ugly for disadvantages. These are a result of Joomla generating dynamic webpages and the need ensure their URL's are unique. With Joomla 1.6 you are more likely to see SEF Ugly than this because of the new default Global Configuration settings.

SEF Ugly (Joomla 1.6 default): http://www.yoursite.org/8-category/7-alias.html
These are findable by search engines but ugly to remember and harder for a visitor to paste in an email. Their length may break a pasted URL in an email, causing lost visitors. Most websites link to other pages of the same site. Admin must paste those links into your site, the easiest way to do that with SEF Ugly links is to browse to the target page while editing the other page, much more trouble than with SEF Pretty URLs. Even with the Global settings above, you may get this if your hosting service has not correctly installed the appropriate server change.

SEF Pretty URL: http://www.yoursite.org/alias.html
This is findable by search engines and easy to remember. It is easier for Admin to type into another page of site or for a visitor to type in an email. This requires Joomla 1.5 or 1.6 with the three SEF settings as above, plus the appropriate server change installed. Notice for these Admin is responsible for ensuring alias names are unique for each page of your site. If there are two pages with the same alias, browsing to either is unpredictable.

You want SEF Pretty URLs as early as possible. They will bring visitors because they remember it or a friend sent them an email about it. Converting from non-SEF or SEF Ugly can be a lot of URL retyping in your site. Search engines rate the URL itself worthy as a search result. Changing the URL later will lose historical search value for that page unless you take more technical measures.