# How to enable Search Engine Friendly URLs in Joomla

### Enabling SEF mode

Within the global configuration settings of Joomla! is a set of SEO (Search Engine Optmisation) settings that you can adjust. In configuring these parameters you will be able to change the various settings concerning your site that some search engines may look in to while visiting your site.

In this tutorial, we'll look specifically at the Search Engine Friendly URLs setting.

* Log into your Joomla! 3.x admin dashboard.
* In the left menu under the SYSTEM heading, click Global Configuration
* There are several tabs at the top: Site, System, Server, Permissions, Text Filters. Ensure you are on the Site tab by clicking on it.
* On the right side of the page under the SEO Settings heading, find the Search Engine Friendly URLs setting. Select either Yes / No to adjust the value.
* Set Use mod\_rewrite to Yes.
* In the top left menu, click Save to save these changes.

<figure><img src="https://norrnext.com/images/docs/enable-joomla-sef-mode.jpg" alt="Enabling Joomla SEF URLs"><figcaption><p>Enabling Joomla SEF URLs</p></figcaption></figure>

The procedure for enabling Search Engine Friendly (SEF) URL’s differs depending on the web server you are using. If you are using shared hosting it is probably Apache but Joomla! may also run on a server other than Apache with the mod\_rewrite module. The SEF URL’s follow a certain fixed pattern, but the user can define a short descriptive text (alias) for each segment of the URL.

### Joomla! SEF on Apache

Go to your joomla\_root directory and locate the file named htaccess.txt and rename the file to .htaccess (notice the proceeding dot .) This can be done either via FTP, SSH or the hosting panel.

Check that the following lines are uncommented:

```
RewriteEngine On
Options +FollowSymLinks
```

In cases of 500 Error you may try to uncomment this line:

`# RewriteBase /`

### Joomla! SEF on Nginx

You also need to rename htaccess.txt file to .htaccess. Then please add the next code to your server (vhost) configuration in nginx.conf file:

```
# Support Clean (aka Search Engine Friendly) URLs

location / {
    try_files $uri $uri/ /index.php?q=$request_uri;
}
```

Now feel free to check out the internal pages of your site, they should work in SEF mode. If this option causes errors, please see How to check if mod rewrite is enabled on your server. If it is not enabled and you have access to the file 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.

If mod\_rewrite cannot be enabled, leave this option off. It does not matter if you leave the .htaccess file renamed.

### Change URL format

Here are some examples how to change the format of website URL i.e. index.php and adding or removing .html suffix through .htaccess.

#### Removing /index.php/

To remove the /index.php/ part from all URLs, you have to set Use URL rewriting param to Yes in Global configuration and then add two lines after the RewriteEngine statement in .htaccess file:

```
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index\.php/
RewriteRule ^index.php/(.*) /$1 [R,L]
```

#### Removing the .html suffix

You can also add two lines to remove the .html suffix if it has been turned on before:

```
RewriteEngine On
RewriteCond %{REQUEST_URI} \.html$
RewriteRule (.*)\.html$ /$1 [R,L]
```

#### Adding the .html suffix

Instead of removing the .html suffix, you might also want to add it to all URL’s. However, this may become a little bit more complicated, because we don't want to rewrite requests for images, CSS-stylesheets and JavaScript-files.

Also, when the browser calls the root of the URL (/) we don't want it to become /.html. Therefore the RewriteRules are a little bit more complicated:

```
RewriteCond %{REQUEST_URI} !\.html$
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /$1.html [R,L]
```

#### Useful links:

* [Enabling Search Engine Friendly (SEF) URLs](https://docs.joomla.org/Enabling_Search_Engine_Friendly_\(SEF\)_URLs)
* [Enabling Search Engine Friendly (SEF) URLs on Nginx](https://docs.joomla.org/Enabling_Search_Engine_Friendly_\(SEF\)_URLs_on_Nginx)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.norrnext.com/joomla-tutorials/how-to-enable-search-engine-friendly-urls-in-joomla.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
