Enable clean URL’s in Magento

in Magento

Clean URL’s are less intimidating to visitors and have a positive effect on search index optimization (SEO) as well.
They “Clean up” the URL structure used when visiting a Magento webshop.

Rather then having URL’s like: https://your.shop/index.php/some/product, after enabling the Search Engines Optimization setting, the URL will instead be rewritten to: https://your.shop/some/product.

This setting does not require additional webserver configuration. To make use of clean URL’s in Magento, all you need to do is adjust the Search Engines Optimization setting in the Magento backend. If you enable this setting, the URL’s containing index.php will be rewritten to URL’s without the index.php.

Enable clean urls

To enable the use of clean URL’s, log in on your Magento admin backend and navigate to:

For Magento 1:
System -> Web -> Search Engines Optimization .

For Magento 2:
Stores -> Configuration -> Web.

From there, enable Use Web Server Rewrites (Select “Yes”), and click Save Config to activate your changes.

As redirects are heavily cached in your local browser cache, sometimes it’s necessary to flush the cache of your browser.

Remove index.php from any URL

To remove the index.php from the URL, use the following snippet and add it to /data/web/nginx/public.rewrites:

rewrite ^/index.php/(.*) /$1 permanent;