Skip to main content

Questions tagged [.htaccess]

Questions about `.htaccess` files in Magento, used to configure the Apache webserver

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Create 301 redirect for all 404 pages to the homepage (404 with any URL combination)

I'm trying creating a redirect for all the 404 pages straight to my homepage. I have tried creating it through .htaccess but seems like it does not worked. .htaccess may ask for the old url & a ...
Areeb Khan's user avatar
0 votes
1 answer
84 views

HTTP to HTTPS redirection

My site won't automatically redirect from HTTP to HTTPS. Have gone through the forums and documentations but can't figure it out so posting. I am quite newbie to Magento. I am using Magento ver. 2.4.1....
Debtanu B's user avatar
0 votes
3 answers
415 views

After installing Magento2.4.6-p2 CSS and JS 404 not found

I installed magento2.4.6-p2 in my C:\xampp\htdocs\magento2. But I can see this. In pub .htaccess file is : ############################################ ## Optional override of deployment mode. We ...
Bohdan V.'s user avatar
0 votes
1 answer
97 views

Magento 2: Client Denied By Server Configuration, Preventing Backend Log On

I was working on the backend of our Magento 2 server and was trying to adjust the layout of our home page. I'm now at a point where it gets stuck loading the admin panel and when I try to navigate ...
Isaac's user avatar
  • 21
0 votes
2 answers
479 views

How to allow access to a folder in Magento root?

I recently upgraded to Magento 2.4.6. I've always had a folder named "PS" with pdf files in my magento root but now I can't access it. I noticed that this line from RewriteRule . /pub/$0[L]* ...
Zei's user avatar
  • 21
1 vote
1 answer
384 views

Header set in .htaccess doesn't work

I am adding below headers in .htaccess file but it is not reflecting in frontend. I have done cache:flush and restart server apache. I am getting - https://i.sstatic.net/mKsoP.png in security headers. ...
user3411's user avatar
  • 144
1 vote
1 answer
49 views

Load magento via .htaccess RewriteRule

I've a very specific problem with magento. At first let me explain what the problem is. I load magento into an iFrame to integrate the store into a webpage. This works like charm until it comes to ...
Jeireff's user avatar
  • 11
0 votes
0 answers
170 views

Apply .htaccess rule for controller and cron

I have some long-running scripts that should bypass the "Connection Timeout" set up in LiteSpeed. I want to do it in the .htaccess file and it works if I apply this rule (*RewriteRule . - [E=...
Kloppo's user avatar
  • 95
0 votes
1 answer
373 views

Proper way to remove .html extensions from URL and do a global redirect

I know how to remove.html extensions from URLs in Magneto 2.3, but I'm unsure what other steps I need to take to make sure I do everything properly. I found that I should also create a global redirect ...
Randy's user avatar
  • 1
0 votes
1 answer
24 views

Display my images in ebay listings (or other website) .htaccess question

I have a Magento site (2.4.3) running on Ubuntu with Apache. I am creating eBay listings which are using images from the https://<mysite.com>/images folder. The images are not displayed. If I ...
brettstix's user avatar
1 vote
2 answers
2k views

Prevent Bot traffic with .htaccess on Magento 2?

How to prevent(block) bad bots traffic with .htaccess for Magento 2 ? What you recommend ? I do not know how to do this. And which codes in .htaccess I need to modify. Or Do we have any other ...
Kaan Burak's user avatar
0 votes
2 answers
2k views

Magento 2.4 move to /pub/ folder, redirects in .htaccess now prepend /pub/. Where are rewrite rules supposed to go now?

So, I have a rewrite rule that is supposed to redirect an old URL to a new one: RewriteRule ^(.*)/-/manufacturers/(.*)$ $1/manufacturers--$2 [R=301,NC] This is located in the .htaccess for the domain (...
Just Some Guy's user avatar
0 votes
6 answers
3k views

Magento 2 Fresh Install Showing 'Whoops, our bad...' 404 page not found

After install very fresh Magento 2, I am seeing Whoops, our bad... (404 Not Found) in all pages. Screenshot: I am using Linux Mint OS. Here is my steps: Installed Apache version is apache2 -v: ...
Shah Alom's user avatar
0 votes
1 answer
403 views

Frontend and Backend is not Working : Magento 2.4.2 ( Internal Server Error)

I am using below configuration Magento 2.4.2 PHP 7.4 Composer 2 Elasticsearch 7.9.6 My installation is in subfolder https://162.241.125.112/Angel/angel Admi url is - https://162.241.125.112/Angel/...
user9386912's user avatar
0 votes
1 answer
4k views

Apache configuration file for Magento 2.4

I have installed Magento 2.4 on Apache 2 sever running on Ubuntu 20.x When I try to load the magento root directory on browser, I get Not Found The requested URL was not found on this server. I have ...
Nocturnal's user avatar
  • 101
3 votes
5 answers
7k views

frontend and admin not working magento 2.4.2 upgrade

Frontend and admin doesn't work or show only 404 not found pages It is installed in a sub directory of root folder The development in command line everything works I can change the .htaccess file , it ...
Alain Stout's user avatar
2 votes
2 answers
6k views

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

I have an problem about magento 2.4.2 Installed magento 2.4.2 using Composer-CLI. But I can't access magento homepage (http://localhost:8888/magento2) The requested URL /pub/ was not found on this ...
Said's user avatar
  • 31
0 votes
1 answer
304 views

How to add 301 Redirect pages in magento 2?

I want to add 301 redirects to these URLs - 1-> From www.abc.com/blog To www.abc.com/blog/ 2-> From www.abc.com/contact To www.abc.com/contact/ 3-> From www.abc.com/catalogsearch/advanced To ...
Vishal Thakur's user avatar
0 votes
1 answer
521 views

Magento 2 - remove .html from URL by using .htaccess

We have some wrong URLs in our store ending with .html. If the user opens such a URL, then the .html should get removed, otherwise the site cant get found. So I added this rule to my .htaccess file in ...
Black's user avatar
  • 3,431
0 votes
1 answer
807 views

CORS Header allow cross origin not working for google fonts

Here I have some code in my .htaccess file <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" Header set X-UA-Compatible "IE=edge" # `mod_headers` cannot ...
Dylan T's user avatar
  • 17
1 vote
1 answer
6k views

How to add the webp format in the mod_expires part of the .htaccess file?

I add this line but it is not taken into account because the browser inspector tells me that the cache is 2 days for webp images: ExpiresByType image/webp "access plus 1 month" I use Plesk with ...
Thomas's user avatar
  • 83
0 votes
1 answer
469 views

For Magento2 how to apply a redirect rewrite in .htaccess file for all URL's from .html to /

For Magento2 how to apply a rewrite in .htaccess for all URL's from .html to / URL structure. The M1 store has .html as the end, the new M2 store has / as the URL ending for all products and ...
MagentoMac's user avatar
  • 1,062
0 votes
2 answers
270 views

magento 1 , how block bad bots on htaccess file

my site is constantly visited by bots and very often I would like to block them because of them, the load on php-fpm on log apache files i have this
Denys Maksiura's user avatar
2 votes
0 answers
439 views

allow any php script instead of 404 page?

I am trying a new local development method on windows using magento 2 on vagrant on windows and it's up and running. Now I'm trying to add xdebug with PHPstorm but it's unable to "see" an uploaded ...
Barry's user avatar
  • 587
0 votes
0 answers
57 views

Internal Server Error 500 after upgrade Magento version from 2.2.6 to 2.2.10

After I upgrade the Magento version from 2.2.6 to version 2.2.10, I get Internal Server Error 500 when I try to access the website. I tried multiple solutions for example (a) removing var folder and ...
Mage Explorer's user avatar
2 votes
2 answers
1k views

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

When I tried to turn on Cloudflare CDN, my site will get "ERR_TOO_MANY_REDIRECTS" error page (the site loads fine if I don't turn on Cloudflare CDN). I checked with the hosting provider, seems like ...
Mage Explorer's user avatar
0 votes
1 answer
46 views

All my directories are accessible magento 1

All my directories (except app/) and my root files (install.php, index.php,.gitignore...) are accessible to the users.. Is it a problem ? I need to create a .htaccess for each my directories ? Thanks ...
Theo Cerutti's user avatar
0 votes
2 answers
420 views

Magento 2 url key includes SKU number, how to remove?

The big problem with Magento somehow amending the url key to include the SKU where /product-title-stec00778.html should be /product-title.html and the SKU is SKU STEC00778 Any ideas? Not ...
Mager Nube's user avatar
0 votes
2 answers
2k views

Redirect all pages to homepage via .htaccess except backend

I've been trying to redirect all pages of my Magento website to homepage via .htaccess - except the backend, naturally. Currently, I'm using these rules and everything is working fine so far but I ...
Josh Smith's user avatar
2 votes
1 answer
753 views

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

I see this file in both Magento one and two, I would like to know what is its functionality in Magento because I have read some articles about it that explains that this .htaccess "file is a ...
Mr F8's user avatar
  • 77
0 votes
1 answer
81 views

Htaccess file erased

I needed to add a line of code to my htaccess file so I downloaded it by FTP using Filezilla to my local machine I now see that the size of the htaccess file on the server is now 0 while the one I ...
Magentohelp's user avatar
2 votes
2 answers
2k views

Document root change help

I am using Magento 2.3.1 Open Source. I installed it from the .zip file in the public_html folder (I didn't know any better at the time) in my account at my web host, running on Apache. I did the ...
Krang's user avatar
  • 167
1 vote
0 answers
813 views

How to redirect default store view to en?

I've got a store with 2 stores, one with 2 languages and the other just 1. So: Website > Store1 > English (www.site.com/en) Website > Store1 > French (www.site.com/fr) Website > Store2 >...
TheNorthern_Light's user avatar
1 vote
1 answer
1k views

Redirect 301 removing parameters in URL by .htaccess

In the file .htaccess in magento, I want to redirect a url with parameters. An example is this: https://example.com/presente/decoracao/teu-sorriso?PageSpeed=noscript I need to redirect this to the ...
Matheus Portela's user avatar
2 votes
1 answer
375 views

Remove '.php' from url redirect [closed]

I have an URL like: base_url/cloths/mens.php now when we click on this above URL then it should redirect to: base_url/wp/cloths/mens/ here we want to remove .php extension from URL after ...
groy's user avatar
  • 351
1 vote
0 answers
361 views

Magento 2 - how do i redirect "mydomain/pub" and "mydomain/pub/media" path to homepage?

I'm trying to redirect "mydomain.com/pub" and "www.mydomain.com/pub/media" to homepage (mydomain.com). Currently, "mydomain.com/pub" path shows the homepage with no css and js loaded, and "www....
Mage Explorer's user avatar
0 votes
1 answer
2k views

Rewrite rule for media images

we need to set rewrite rule for some images in Magento 2.2.5 using .htaccess rules or nginx conf Example 1 Request Path: https://www.example.com//media/catalog/product/cache/1/thumbnail/543x403/...
Knight017's user avatar
  • 632
1 vote
1 answer
6k views

Magento 2 .htaccess file missing in pub folder

I was recently trying to upgrade my Magento 2.2.7 to Magento 2.3.0 and the following message came up in component dependencies Found non-writable path(s): /var/www/vhosts/powermyself.com/httpdocs/pub/...
CJNotts's user avatar
  • 412
1 vote
1 answer
34 views

.htaccess redirect samplesitex.com to samplesitey/alias-page in both https and http variants

I am trying to redirect an alias url to a different url path. (it wont let me do this in cpanel for some reason) Example: SiteX.com > SiteY.com/this-page I have tried RewriteCond %{HTTP_HOST} ^...
Craig Gillett's user avatar
1 vote
2 answers
4k views

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

As in Magento 1 to increase the page speed score and Y-slow score we have used Leverage Browser Caching for Images, CSS and JS code in .htaccess file but same script in Magento2 is not working. ...
akgola's user avatar
  • 2,967
0 votes
1 answer
199 views

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

Magento 1.9.1 Porto theme My hosting company created a new account for me and moved my existing account there. That replaced the broken cPanel account and I am now able to access the database via the ...
Allysin's user avatar
  • 280
0 votes
2 answers
477 views

How to forbid access to .htaccess File in Magento 2?

If I call the .htaccess file in the browser e.g. https://www.mycompany.com/.htaccess, then it is getting downloaded. Is there a way to fix this? I added this block to my .htaccess file, but it does ...
Black's user avatar
  • 3,431
1 vote
1 answer
868 views

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

My Magento Backend URL is not working and fronted is working Properly. Backend Url:- http://hotandbold.com/staging/admin_jewellery/ Fronted Url:- http://hotandbold.com/staging/ Can You suggest me, ...
Kumar Vivek's user avatar
1 vote
0 answers
81 views

Are the Magento 2.1.14 rewrite rules in htaccess file working properly?

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,...
Jason's user avatar
  • 538
1 vote
1 answer
2k views

404 Error when accessing image in pub/media

Ive been struggling with this for a few weeks now and dont seem to be getting anywhere. I have installed a module that reads images from a directory 'pub/media/import' however when I navigate to the ...
jacknely's user avatar
4 votes
3 answers
159 views

alias for login page as /accounts

We have a magento website on /store folder. Idea is, on root folder, index.php will have company website. /store folder will have magento folder. Idea is, www.example.com/account should load login ...
KuKu's user avatar
  • 99
1 vote
1 answer
60 views

Nice, clean URL for my store

I want that that, when I navigate to myStore.com the displayed contents are actually the ones of myStore.com/subdirectory but without changing the URL. I tried different configurations of ....
LeCodeur's user avatar
  • 366
1 vote
0 answers
2k views

Mysql server goes down with queries in SLEEP STATE when I access magento site

We have a Magento 1.9.2.4 site. We are accessing it on using a subfolder and subdomain as http://dummysite.com/magentosite and http://magentosite.dummysite.com Here we would live to mention that our ...
Nidhishanker Modi's user avatar
0 votes
1 answer
3k views

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

I am doing a rest call from Magento to Angular 2. I am facing this CORS issue and trying many workarounds but nothing seems to work. Figured out its server side issue and made the below changes in ...
Sushivam's user avatar
  • 2,639
0 votes
2 answers
316 views

Transferring magento website to sub domain gives 404 error but works fine on main domain

I have a magento (1.9.2.1) setup on a main domain ( www.mysite.com ) and now I want to transfer it from main domain to subdoamin like (sub.mysite.com). Changed app/etc/local.xml file details Cleared ...
sultan's user avatar
  • 1