Joomla still prints index.php in URLs when Search Engine Friendly URLs is on but Use URL Rewriting cannot finish: htaccess.txt was not renamed, RewriteBase is wrong, or Apache mod_rewrite, nginx try_files, or IIS web.config is missing. SEF alone turns query strings into aliases. Only a working rewrite removes index.php from the path.
On Joomla 4, 5, and 6 this is a three-layer stack: Joomla settings, the rewrite file, and the web server. Turn on the wrong layer first and you either keep /index.php/article-alias or you generate pretty URLs that 404.

SEF builds the alias. Rewriting is what drops index.php from the address bar.
What you will learn
- What SEF does versus what URL Rewriting does
- The exact Global Configuration switches
- How to rename
htaccess.txtand setRewriteBase - How nginx
try_filesand IISweb.configreplace Apache rules - Why Add Suffix is a different switch
- How to 301 leftover
index.phpURLs after the site is clean
Two switches, three URL shapes
Open System → Global Configuration → Site and scroll to SEO. Official field list: Global Configuration. Full rewrite walkthrough: Enabling Search Engine Friendly (SEF) URLs. Apache-specific steps: Enabling SEF URLs on Apache.
| Setting | What Joomla generates | What you see |
|---|---|---|
| SEF off | Query string | /index.php?option=com_content&view=article&id=12 |
| SEF on, Use URL Rewriting off | Alias with front controller | /index.php/getting-started |
| SEF on, Use URL Rewriting on, server rewrite works | Alias only | /getting-started |
| SEF on, Use URL Rewriting on, server rewrite fails | Joomla still prints the pretty URL | Browser 404s. The menu looks clean. Pages do not load. |
If index.php is still in the links Joomla prints, Use URL Rewriting is off, or a template/module is hardcoding the old form. If links are already pretty but Google lists index.php, the generator is fixed and you still need 301s. That is a crawl problem, not a missing rename.
Also enable System – SEF under System → Plugins. That plugin rewrites links inside article HTML. It does not replace Apache or nginx.

Do these in order. Turning on Use URL Rewriting before the rewrite file exists is how pretty URLs 404.
Step 1: Turn on Search Engine Friendly URLs first
In Global Configuration, set Search Engine Friendly URLs to Yes and save. Confirm a menu link now looks like /index.php/your-alias instead of option=com_content.
If SEF is already Yes and you still see query strings, a third-party router or a hardcoded template link is bypassing Joomla's router. Fix that after the core stack works.
Leave Add Suffix to URL alone until rewriting works. Suffix adds .html. It does not remove index.php. Mixing both jobs in one sitting is how people think "SEF failed" when they only changed the suffix.
Unicode Aliases is also separate: it controls whether aliases stay in native script or transliterate. It will not strip index.php.
Step 2: Rename htaccess.txt (Apache and LiteSpeed)
Joomla ships htaccess.txt so a default install cannot break hosts that ignore .htaccess. Rewriting will not start until you rename it.
In the Joomla root:
- Rename
htaccess.txtto.htaccess. - Confirm the file is in the same folder as
configuration.phpandindex.php. - Confirm Apache allows overrides (
AllowOverridefor that directory). If the host ignores.htaccess, renaming does nothing.
Official note in Global Configuration: Apache and LiteSpeed rename htaccess.txt to .htaccess. IIS uses web.config.txt. nginx has no .htaccess. See preconfigured htaccess.
Step 3: Set RewriteBase when Joomla is not in the domain root
Open .htaccess. Find the commented RewriteBase / line. Uncomment it (remove the #).
| Install location | RewriteBase |
|---|---|
Site is https://example.com/ |
RewriteBase / |
Site is https://example.com/joomla/ |
RewriteBase /joomla/ |
A wrong RewriteBase after a move from a subdirectory to root (or the reverse) is a common reason index.php never disappears, or pretty URLs 404. Details: Moving the site among directories/sub-directories.
Apache must actually load mod_rewrite. If the module is off, leave Use URL Rewriting off until the host enables it. Generating pretty URLs the server cannot route is worse than living with index.php for a day.
Step 4: Turn on Use URL Rewriting and test one URL
Back in Global Configuration, set Use URL Rewriting to Yes and save.
Test three things:
- A menu link in view-source or in the address bar after click: no
index.php. - That same pretty URL typed directly: 200, not 404.
- The old
/index.php/aliasform: decide whether it still 200s (duplicate) or 404s.
If pretty URLs 404, turn Use URL Rewriting back to No immediately so the site works, then fix the server file. Do not leave the site generating links the server cannot serve.
How Joomla builds those aliases: Search Engine Friendly URLs.
Step 5: nginx try_files or IIS web.config
nginx does not read .htaccess. Use URL Rewriting still tells Joomla to omit index.php. The server must send unknown paths to the front controller. Official nginx notes: Nginx.
A typical location block includes:
try_files $uri $uri/ /index.php?$args;
Without try_files, Joomla prints /getting-started and nginx returns 404. index.php URLs may still work, which looks like "SEF is half on."
IIS: rename web.config.txt to web.config in the Joomla root (same Global Configuration help text). The IIS URL Rewrite module must be installed. Official IIS section lives on the SEF URLs page.
Step 6: Clear cache, then 301 leftover index.php URLs
Clear Joomla cache. If a CDN or page cache stored HTML with index.php in hrefs, purge that too.
Then inventory duplicates: /index.php/alias versus /alias. Google may have the old form. Collapse them with 301s so you are not ranking both. Causes and the rest of the duplicate set (www, print, two menus) are in Joomla duplicate URLs. Making the 301 actually fire is Joomla 301 redirects not working.
This is core Joomla on-page optimization. If the host cannot enable mod_rewrite or nginx try_files, say so before you promise clean URLs. For a site that still needs a rewrite pass, Joomla SEO services.
Key takeaways
- SEF creates aliases. Use URL Rewriting plus a working server rewrite removes
index.php. - Rename
htaccess.txtto.htaccessbefore you turn rewriting on (Apache and LiteSpeed). - Set
RewriteBasewhen Joomla lives in a subdirectory. - nginx needs
try_files. IIS needsweb.configand the URL Rewrite module. - Add Suffix (
.html) is not theindex.phpswitch. - After links are clean, 301 the old
/index.php/...URLs so Google drops the duplicate.
Frequently asked questions
Why does Joomla still show index.php in URLs with SEF on?
SEF only replaces the query string with aliases. You still see /index.php/alias until Use URL Rewriting is Yes and the server rewrite file is active.
I renamed htaccess.txt. Pretty URLs 404. What now?
Turn Use URL Rewriting off so the site works. Then fix RewriteBase, mod_rewrite, or nginx try_files. Joomla was generating paths the server could not route.
Does Add Suffix to URL remove index.php?
No. It appends a suffix such as .html. Remove index.php with URL Rewriting, not with suffix.
How do I fix index.php URLs on nginx?
Keep SEF and Use URL Rewriting on in Joomla, and add try_files $uri $uri/ /index.php?$args; in the site's location block. nginx will not use .htaccess.
What about IIS?
Rename web.config.txt to web.config and install IIS URL Rewrite. That is the IIS equivalent of Apache .htaccess rewriting.