Skip to main content
Share Your Experience: Take the 2024 Developer Survey
11 votes
Accepted

Accidentally deleted .htaccess file inside pub/static folder

You can download corresponding file from the official Magento 2 repository. That will solve your problem.
Siarhey Uchukhlebau's user avatar
6 votes
Accepted

Redirecting HTTP to HTTPS?

I fixed it by adding RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://mydomain.co.uk/$1 [L,R=301] To my .htaccess and setting Auto-Redirect to base url to No Hope this helps someone
AspiringProgrammer's user avatar
4 votes

Images not showing properly in email when site is password protected

Thats the correct behavior. Most of the Mail Clients can't or do not want interpret the password protection, because it can be used for phishing attacks. Web Mail-Clients like google, even didn't show ...
Pawel's user avatar
  • 1,096
4 votes

frontend and admin not working magento 2.4.2 upgrade

I am really amazed that Magento pushed this to release without documenting it in the release note or "backwards incompatible" changes, but they did. They mention it in the installation notes,...
iphigenie's user avatar
  • 1,729
3 votes

Magento htaccess frontend authentication

You can use the IP and Authentication together Below I have two ip's incase you needed an example for how to handle additional. If your image upload is hitting the authentication still then you ...
danmentzer's user avatar
2 votes

Local installation of Magento 2 doest not generate files in the pub/static folder

If all else fails, prune these directories: rm -rf pub/static/* # DO NOT DELETE .htaccess rm -rf var/view_preprocessed/* php bin/magento setup:static-content:deploy This will work if you've got ...
snez's user avatar
  • 744
2 votes

Magento HTACCESS query 301 redirect all but admin

This version will allow you to still see the admin styles. RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{REQUEST_URI} !^admin RewriteCond %{REQUEST_URI} !^/skin ...
Gillian's user avatar
  • 21
2 votes

This page isn’t working hotandbold.com redirected you too many times

Here is solution Go to database find table core_config_data and search Path value "web/cookie/cookie_domain" remove this row and try.
Pratik's user avatar
  • 3,805
2 votes
Accepted

Magento 2 .htaccess file missing in pub folder

You can copy .htaccess file from github repository. Copy it from https://github.com/magento/magento2/blob/2.3-develop/pub/.htaccess If you have already upgraded to version 2.3, you will need ....
amitshree's user avatar
  • 7,036
2 votes

Magento 2 Leverage Browser Caching for Images, CSS and JS not any effect

I had also faced the similar issue, even after updating .htaccess caching was not applied to files. Enable mode expires module and restart apache2, fixed issue. sudo a2enmod expires sudo service ...
Pkrishna's user avatar
2 votes
Accepted

How can I add mod expires to htacess but still update site?

Yes. Enable css / js merging. This will add a hash to the generated files. When you clear js / css merge cache, new files are generated. New hash. Client gets new file. Merging css or js can have ...
ProxiBlue's user avatar
  • 9,926
2 votes

how can i change all urls of old website

add below in your old domian .htaccess file RewriteEngine on RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
Prashant Valanda's user avatar
2 votes
Accepted

what is .htaccess file for in Magento, is it important in anyway?

.htaccess-Files are used by apache-webserver to be able edit/extend the webserver-config as a "normal"-user. I.e. you can do in this file much that would normally require editing the global ...
Tim Riemenschneider's user avatar
2 votes
Accepted

"ERR_TOO_MANY_REDIRECTS" when turn on Cloudflare CDN possible .htaccess file issue

Source: https://magento.stackexchange.com/a/182783/69 Just to close this out, a good friend of mine suggested I try this, and I am very pleased to say it worked. Perhaps it will help someone ...
B00MER's user avatar
  • 8,307
2 votes

The requested URL /pub/ was not found on this server. - Magento .htaccess problem

I think your problem is already known issue when using 2.4.2 for the first time and with a setup that doesn't point to /pub folder (the webserver doesn't know that it has to serve the requests from ...
Diana's user avatar
  • 5,182
2 votes

frontend and admin not working magento 2.4.2 upgrade

Magento 2.4.2 is now serving all content from magento_root/pub most sites won't notice this change because of the rewrites in the 2.4.2 version of magento_root/.htaccess https://github.com/magento/...
paj's user avatar
  • 5,874
2 votes

frontend and admin not working magento 2.4.2 upgrade

After Installed magento 2.4 version your localhost support with /pub directory like {localhostname}/pub/index.php We can access without pub directory follow below steps 1. Copy .httaccess file from ...
Baharuni Asif's user avatar
1 vote
Accepted

Redirect all pages to homepage via .htaccess except backend

Create a .htaccess file containing only this should work (backup the original one): RewriteEngine on RewriteCond %{REQUEST_URI} !^/office RewriteCond %{REQUEST_URI} !^/index.php/office RewriteCond %{...
Christoph Farnleitner's user avatar
1 vote

Redirect all pages to homepage via .htaccess except backend

Try this RewriteEngine on RewriteCond %{REQUEST_URI}!^/office/ RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
Abdul Pathan's user avatar
  • 2,812
1 vote
Accepted

Document root change help

Depending on your host you may be able to sort yourself. Do you have a cpanel login? Check this demo https://demo.cpanel.net:2083/cpsess6663391586/frontend/paper_lantern/index.html?login=1&...
Dominic Pixie's user avatar
1 vote
Accepted

Redirect 301 removing parameters in URL by .htaccess

You can try to use two rewrite conditions - one for the QUERY_STRING and one for the REQUEST_URI and let the matching pattern be .* in the rewrite rule. RewriteCond %{QUERY_STRING} ^PageSpeed=...
HelgeB's user avatar
  • 4,521
1 vote

Magento 2 Leverage Browser Caching for Images, CSS and JS not any effect

Add the following at the following: root > .htaccess file # Leverage browser caching using mod_expires # <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus ...
Teja Bhagavan Kollepara's user avatar
1 vote
Accepted

other website/store/store front does not load; .htaccess file is missing

I see you are having too many problems with your host.If you have a good website with big data i suggest you go for Nexcess as host . They have a good support and you dont have to worry about anything ...
Ylgen Guxholli's user avatar
1 vote
Accepted

alias for login page as /accounts

A way to do it : RewriteEngine on RewriteCond %{REQUEST_URI} ^/account RewriteRule ^(.*)$ /store/customer/account/login/ [P] It use P Proxy flag (which implies L flag too). To use it, make ...
Nicolas PERNOT's user avatar
1 vote

Nice, clean URL for my store

Have you tried using virtualhost configurations? This is a very common directory structure. Its super common that we install Magento in a location other than www/html Refer http://inchoo.net/magento/...
Dilhan Maduranga's user avatar
1 vote

Magento .htaccess Response for preflight has invalid HTTP status code 400

Include below lines in Magento .htaccess file, present in the root folder of Magento. It worked for me. Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-...
Tejeswar Pratap's user avatar
1 vote

Magento Secure Magmi from unauthorized access using htaccess

make a curl to http://canihazip.com/s to find out the IP of the webserver when making remote requests. It could be this differs from the incomming server IP. Add that IP to your whitelist. ...
Robin van Raan's user avatar
1 vote
Accepted

Multistore using .htaccess not working

First a reference: Answer by George Lerner at: https://stackoverflow.com/questions/17550223/set-an-environment-variable-in-htaccess-and-retrieve-it-in-php To test, in [docroot]/.htaccess put a couple ...
gwideman's user avatar
  • 515
1 vote

EDIT: How to protect index.php/admin url using htaccess

You should be able to do this using the combination of mod_env and the Satisfy any directive. You can use SetEnvIf to check against the Request_URI, even if it's not a physical path. You can then ...
Nikunj Vadariya's user avatar
1 vote

Accidentally deleted .htaccess file inside pub/static folder

You can find the .htaccess file from below path : https://github.com/magento/magento2/tree/2.4-develop/pub/static Hope it may help you!
Bhavesh Prajapati's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible