In the default htaccess file in Magento 2.1 there are some RewriteCond's and RewriteRule's that are explained in the htaccess.sample file that comes with Magento 2.1.

never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

rewrite everything else to index.php

RewriteRule .* index.php [L]

When I typed my domain name with a random file name or directory into the web address bar of my browser it throws a 404 page with the unfound url still in the adress bar of the browser. I don't consider this undesirable and actually do not mind this (for SEO purposes), but given that the RewriteRule line is supposed to "rewrite everything else to index.php" is this correct behavior? Do I still need this RewriteRule?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.