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

Magento 2 Multistore is not working with multi domain

I had the very same problem with MAGENTO 2.1.7 . After reading thousands (literally) of blogs, tutorials and websites I figured it out by sticking a few lines of code. 1 : Do not touch the .HTACCESS ...
Steve Jesiolowska's user avatar
8 votes
Accepted

How to secure Magento version control systems

In .htaccess on your server config file. (1) RewriteEngine on RewriteRule "^(.*/)?\.git/" - [F,L] And (2) RedirectMatch 404 /\.git Place this both method in .htaccess file. It hides any file or ...
Adit's user avatar
  • 96
8 votes
Accepted

Magento 2: Apache mod version not enabled/installed/allowed by host, causes 500 error on all pages due to failing .htaccess files

This problem is caused when apache's mod_version module is not enabled. Unfortunately, my host does not allow me to enable this module and so I have devised the following workaround: Step 1 Open [...
Muckee's user avatar
  • 699
7 votes
Accepted

Rewrite URL using GET params

By default, Magento2 has 4 routers Base > CMS > URL Rewrite > Default In your case, you should create a custom router. I can suggest you create a custom module and then create a custom router to solve ...
bachlee89's user avatar
  • 1,287
6 votes

How to block cpanel link of my magento site

First thing you need to understand is that: for a webserver, both the owner and normal site visitors are the same. There is no default mechanism to identify a "Site owner". To achieve your goals, you ...
Nidheesh's user avatar
  • 1,048
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
6 votes
Accepted

Unable to access magento without /index.php/ in the URL

Your problem is with .htaccess file. Take the .htaccess file from this git repo and put that file inside your Magento root directory Git Repo. Put this piece of code inside the .htaccess file. ...
Asheem Patro's user avatar
  • 1,070
6 votes

How to remove trailing slash from Magento 2 url

Magento admin you can use store direct_url for remove trailing slash. example: <a href="{{store direct_url='contact-us'}}">Contact</a>
Savan Patel's user avatar
  • 2,358
5 votes

Restrict access to admin area by IP

In case anyone uses Nginx: location ~* ^/(index\.php/bcknd|bcknd) { allow 1.1.1.1; try_files $uri $uri/ /index.php?$args; location ~* \.php$ { try_files /dummy @proxy; } deny all; }
MartyS's user avatar
  • 934
5 votes

Getting 404 Not Found Error on every page except index.php

the solution for 404 errors on magento 1.9 was to 1-reindex data and 2-flush cache storage
dsk's user avatar
  • 51
5 votes

How to Block RSS in .htaccess?

Rule works on 1.7: RewriteCond %{REQUEST_URI} ^/(index.php/?)?rss/ [NC] RewriteCond %{REMOTE_ADDR} !^1.1.1.1 RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=302,L] The rule below is the rule Magento ...
Icon's user avatar
  • 2,439
4 votes
Accepted

automatic generation of dir/files under pub/static not working

There are two different scenarios: developer mode you should not run the command at all (more info: Which compilation commands are needed in developer mode and when? ) the original pub/static/....
Fabian Schmengler's user avatar
4 votes

Magento 2: Apache mod version not enabled/installed/allowed by host, causes 500 error on all pages due to failing .htaccess files

Note you will need to remove the "IfVersion" commands from every .htaccess file in Magento, after the installation too. These are the files I had to modify with a fresh install Magento2 (2.4) and on ...
Erica Southworth's user avatar
4 votes

How to add 301 redirection rule magento2?

Here it is step by step answer for it. Log into your Magento 2 Store Admin panel Click on ‘Marketing’ module on the left toolbar Under SEO & Search -> click on URL Rewrites Click the Add URL ...
Mayur Sisodiya's user avatar
3 votes

Brute Force attack error in magereport tester

Protect your Magento Store to Brute force attacks. Follow following step. Apache Server Users To whitelist an IP address for the admin panel, add the following rule in root .htaccess file (inside <...
Randhir Yadav's user avatar
3 votes
Accepted

Brute Force attack error in magereport tester

In the place you put above code, please add below one and try again. RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^.*/RSS/CATALOG [OR,NC] RewriteCond %{REQUEST_URI} ^.*/RSS/ORDER [OR,NC] ...
Shyam Krishna Sreekumar's user avatar
3 votes

Brute Force attack error in magereport tester

What does Magereport check for? Magereport checks these URL’s: /index.phprss/catalog/notifystock/ (yes, without the slash) /admin /downloader An error is raised, when an admin/downloader login ...
Rajan Soni's user avatar
  • 1,019
3 votes

Magento 2: Using nginx -- All Static Assets are 404

Alan Storm & Manelio are pointing you in the correct direction. Basically nginx is not doing a rewrite on the /static sub-directory. This below code is likely all you need added to your nginx.conf ...
Joshua Fricke's user avatar
3 votes
Accepted

Magento Admin URL [Permission with Whitelist IP]

I think if you add the OR for index.php in your first example, it will work. Here is an example of what is working for me: #Restrict admin access RewriteCond %{REQUEST_URI} ^/(index.php/)?...
Tim Cieplowski's user avatar
3 votes

How to create wild card sub domain in Magento 1.9.x

You will need to rewrite the following classes for starter Mage_Page_Block_Html_Topmenu Mage_Page_Block_Html_Footer Mage_Catalog_Model_Product_Url Mage_Catalog_Model_Layer_Filter_Item like below &...
Elamurugan's user avatar
3 votes
Accepted

htaccess file on Magento director not working

What is the web server you are using ? Apache or nGinx ? Updated Answer Since you are using Apache, make sure that you have enabled mod_rewrite in your server. To enable mod_rewrite, follow the ...
N. Karthic Kannan's user avatar
3 votes
Accepted

How to remove index.php from url if we enter manually

Add this in your .htaccess after RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ https://domain.com/$1 [R=301,L] Change domain.com to your domain and check ...
BartZalas's user avatar
  • 1,757
3 votes
Accepted

Magento2.4.2 multi website setup not working

Magento 2.4.2 now enforces the best practice of 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 ...
paj's user avatar
  • 5,874
2 votes

Magento 1.9 - .htaccess file missing

Stock 1.9 .htaccess ############################################ ## uncomment these lines for CGI mode ## make sure to specify the correct cgi php binary file name ## it might be /cgi-bin/php-cgi # ...
Joel Davey's user avatar
2 votes

Redirect www to non-www keeping the path

With code @Ben Lessani, if you need without www. RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteRule ^(.*)$ http://domain.com%{REQUEST_URI} [R=301,L]
jruzafa's user avatar
  • 285
2 votes

htaccess Rewriterule to remove trailing slash

This removes trailing slashes and redirects uppercase to lowercase as well # Remove trailing slashes (consider backend) RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{REQUEST_FILENAME} !-f ...
Eugene Lycenok's user avatar
2 votes
Accepted

Issue in URL not showing www with domain name

Go to System->Configurataion->General->Web->Unsecure / Secure->Base URL and add change values to your domain with www. Also you can update this value directly in DB. Open core_config_data table, ...
DmitryFurs's user avatar
2 votes

Brute Force attack error in magereport tester

I was getting same issue and i have fixed it by using these rule in root .htaccess file. Note: it should be written before enable rewrites code RewriteEngine on <IfModule mod_rewrite.c> ...
Nadeem0035's user avatar
  • 1,245
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
Accepted

Nginx auth off whole folder

I believe you'd want location to look like this (as /api will tend to forward to /index.php/api from what I've seen in access logs, this rule should cover both) location ~* ^/(index.php/)?api { }
Ricky Odin Matthews's user avatar

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