In this tutorial, we will be looking at removing index.php from the URL's generated on the frontend for better SEO of your Joomla 4 site.
By default here is what a menu item URL looks like in Joomla.
Explaining the URL a little:
http://localhost/joomla4_alpha is the root of a Joomla install if your website name is abc.com your root will be http://abc.com.
index.php/movies/ ==> movies is the alias of the menu item on the backend, index.php is something that’s added to every URL as this is how URL’s works by default in Joomla.
This Joomla tutorial will work for Joomla 3 as well.
Enable URL Rewriting
To enable URL rewriting login to your Joomla backend and go to System >> Global Configuration
In the very first tab (site), click the button Use URL rewriting
Now before you save the settings here, you have to rename a file or all your website URL's will result in a 404 error.
Rename htaccess.txt file
Login to the FTP so you can browse files for your Joomla installation.
Once there, rename the file htaccess.txt to .htaccess.
Once done, you can go back to the Joomla screen and save the changes and your new SEF URL’s would look something like http://localhost/joomla4_alpha4/movies, which is much better for SEO.
Let me know if I missed anything in the comments down below?