1

Ive just started working on a Magento 2 site (2.1.9) and trying to add a 301 rewrite to pub/static/.htaccess so that when someone enters an old URL with index.php it removes the index.php with a 301 rewrite.

However when I enter any changes in the htaccess file located in pub/static/, they're being completely ignored...

RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*/index.php     
RewriteRule ^(.*)index.php$ https://domain.com/$1 [R=301,L]

Am I missing something? surely I shouldn't have to re-deploy the static files?

3
  • 1
    This is because the htaccess you should be modifying is within the root of magento. you can also achieve this using the rewrite manager under the marketing tab Aug 22 '19 at 21:47
  • Thanks thats sorted it Aug 27 '19 at 11:36
  • Glad to hear any other issues don't hesitate to create a new post Aug 27 '19 at 20:00

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.