How to Enable Search Engine Friendly (SEF) URLs in Joomla 3

How to Enable Search Engine Friendly (SEF) URLs in Joomla 3

The Joomla default installation does not have search engine friendly URLs enabled. If you want to make the URLs of your Joomla site more readable and understandable to both human beings and search engines, you will have to enable SEF URLs manually.

This post offers a step-by-step guide for enabling SEF URLs and removing the useless and unimportant parameters including index.php. There is no need to install any third-party plugin or component.

But note that what discussed below only applies to Apache web server and Joomla 3.x. If you are using other web servers like IIS, please contact your hosting provider for support.

Adjust Joomla SEF URL Settings

First of all, you need to configure some settings in the backend admin area of your Joomla site before you can rewrite URLs. Below are the detailed steps.

Step 1: Log into the administration panel of your site. The login URL should be http://mysite.com/administrator. Please remember to replace “mysite.com” with your own domain name. Also, don’t forget the directory name if you have installed Joomla in a sub-directory.

Step 2: In the top menu, click on System > Global Configuration. Under the “Site” tab which is opened automatically, you can find a section for “SEO Settings”. Now find the line of “Search Engine Friendly URLs”, and set the option next to it to “Yes”. Then, save the changes.

Adjust Joomla SEF URL Settings

Refreshing your website, you can see the changes of your website URLs. For example, the old URL of an article which is not optimized would look like this:

http://mysite.com/index.php?option=com_content&view=article&id=15:featured-article-test-1&catid=2&Itemid=101

Such a URL includes many parameters which do not mean much to readers and search engines. But after enabling the SEF URLs, the URL of the same article is changed to:

http://mysite.com/index.php/15-featured-article-test-1

This URL is much cleaner than before. While in fact, you can still optimize it and make it shorter and more concise by removing the article ID (which is “15” in the example) and index.php. As the removal of article ID has already been discussed in another tutorial, we will only discuss the other task here.

Remove index.php from Website URLs

This includes two steps – to change the Joomla SEO settings and to modify the .htaccess file. The first step is easy as you only need to set “Yes” to the “Use URL Rewriting” option under the SEO Settings of Global Configuration.

Use URL Rewriting

For the second step, you have to access your server to modify a file in the directory where Joomla is installed. Take cPanel as an example. You can use File Manager to find the file named “htaccess.txt” in the directory of Joomla installation.

htaccess.txt

Now you should do the following things. Please remember to make a local copy of the file before giving any modification.

Firstly, rename the file to .htaccess. This can be done by right-clicking the file and choosing the “Rename” option. Do NOT ever forget the dot at the beginning of the file name.

Secondly, edit the file, find the following line of code, and delete the “#”.

	# RewriteBase /

If Joomla is installed in a sub-directory, such as http://mysite.com/joomlasite, you also need to insert the directory name after the “/” just like the example below. But if Joomla is installed in the root directory, nothing needs to do.

	RewriteBase /joomlasite

When index.php is removed successfully, the URL of the article mentioned above would be like http://mysite.com/15-featured-article-test-1