How do I remove index.php from my URLs?
Rename htaccess.txt to .htaccess, then turn on Use URL Rewriting in Global Configuration → Site → SEO.
What the settings do
Joomla can show three kinds of addresses. With Search Engine Friendly URLs off: index.php?option=com_content&view=article&id=12. With SEF on: index.php/about-us. With SEF and URL rewriting on: /about-us. The last one needs a server rule, which is what .htaccess provides on Apache.
Apache (most hosting)
- In your site folder, rename
htaccess.txtto.htaccess(keep a copy if you already have a.htaccess). - Go to System → Global Configuration → Site, panel SEO.
- Set Search Engine Friendly URLs to Yes and Use URL Rewriting to Yes. Save.
- Open a few pages on your site to check they load.
Nginx
Nginx doesn't read .htaccess. Add the try_files $uri $uri/ /index.php?$args; rule to your server block (see the official "SEF URLs on Nginx" guide), or ask your host.
Good to know
- Add Suffix to URL adds
.htmlto addresses; turn it on only when you start, because it changes every URL. - If pages give 404 or 500 after turning it on, see "Turning on URL Rewriting broke my site".
Sources
- Search Engine Friendly URLs – Joomla User Guide
- The htaccess.txt file – Joomla User Guide
- SEF URLs on Nginx – Joomla User Guide