top of page

Magento 2.4.2 .htaccess changes...

I have just noticed, In Magento 2.4.2 release, the Magento root folder .htaccess file changed completely compared to the 2.4.1 release. I found this commit without much explanation, due to this change if the URI does not starts with pub, setup, update, dev, it will rewrite to the magento-root/pub/*. Previously magento recommends to set pub/ as doc root for the security reason. I hope this is the reason they modified .htaccess.

In the below examples, we set magento-root/ as doc root in the apache (not magento-root/pub/)

Example 1:

http://magento.default.m242/static/version1613058997/frontend/Magento/luma/en_US/mage/calendar.css (This will work because this URI does not start with pub so rewrite to pub/)


http://magento.default.m242/pub/static/version1613058997/frontend/Magento/luma/en_US/mage/calendar.css (This will also work because this URI already starts with pub so it will work as usual)


Example 2:

If we create a test.html file inside magento-root/, it will show 404 when we access http://magento.default.m242/test.html, because it does not start with pub so it will rewrite to pub/, in pub/ we don't have test.html so it will show 404 not found page.


If we create a test.html file inside magento-root/pub, it will show the page correctly when we access http://magento.default.m242/test.html, because it does not start with pub so it will rewrite to pub/, in pub/ we have test.html so it will show page correctly.

 
 
 

Recent Posts

See All
Split file by line number - Ubuntu

We can run the below command to split the large file in Ubuntu. split --numeric-suffixes=1 --additional-suffix=.csv -l 100 original.csv...

 
 
 

Comments


Follow Me

  • LinkedIn
  • Twitter
  • Facebook
  • YouTube
  • Instagram

©2021 by Bilal Usean. Proudly created with Wix.com

bottom of page