6 votes

Magento 2: Bulk 301 rewrite imports

If you can load your CSV file content then This is the way to import Bulk URL Rewrite: Add below Code into script than run it. // MAGENTO START include('../../../app/bootstrap.php'); use ...
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
user avatar
6 votes
Accepted

How can I programmatically perform a 301 redirect in Magento 2

In your class declare the variable /** * @var \Magento\Framework\App\ResponseInterface */ protected $_response; In constructor initialize the object public function __construct ( ...
user avatar
  • 1,328
5 votes

Magento 2 with Varnish sometimes does not redirect HTTP to HTTPS

The issue was the Pound was only listening to 443 (https) and all HTTP was going straight to Varnish. Magento was supposed to be redirecting but sometimes Varnish would just send the HTTP version. ...
user avatar
  • 316
4 votes

301 Redirect Not Working. URL syntax bad for the .htaccess file?

The problem is that the synthax is not the same when there is variable in URL. Please try RewriteCond %{QUERY_STRING} ^format=ATOM$ RewriteRule ^Blog/post/feed/2013/06/20/NASA-Gets-In-On-the-Search-...
user avatar
  • 514
4 votes

Magento 2.2.5: Admin login page redirect loop 301/302 after installing SSL and enabling HTTPS

Try the following query: SELECT * FROM `core_config_data` WHERE path = 'web/secure/use_in_adminhtml' ; if path web/secure/use_in_adminhtml has value of null Update the value to 1 using the ...
user avatar
3 votes
Accepted

302 redirect issues. Page header shows 302 for all pages

I fixed it - in my case a GEO Location extension was responsible for the issue. Anyway - to check in general I recommend to take a look in .htaccess index.php search for keywords like "...
user avatar
  • 405
3 votes
Accepted

Redirect if homepage

You can have it easier than a rewrite! Just set the homepage to a url you want. System > Config > General > Web > Default Pages > Default Web Url There you can fill in whatever you ...
user avatar
3 votes

Magento Product URLs are not preserving URL parameters

I had the same issue with the CREARESEO extension. I fixed it by doing the following: Open /app/code/community/Creare/CreareSeoCore/Model/Observer.php Find: public function ...
user avatar
3 votes
Accepted

Why do special characters in search terms are processed as encoded characters (only on Production Server)?

The first thing I noticed was that the search returns an 301 redirect with the HTTP header Content-Type: text/html; charset=iso-8859-1 and the wrong URL http://caserisimo.mx/catalogsearch/result?q=br%...
user avatar
2 votes

Redirection from observer not working (Fullpage Cache + APC turned on)

As per our discussion in the IRC, use webserver redirects. Your goal is to redirect old urls to new urls. This is the job of the webserver, not the application. Otherwise you are loading the ...
user avatar
2 votes

Htaccess - How can i make this redirect a 301 instead of 302?

Try appending [R=301] to your RewriteRule entries. If you have existing parameters (like [L]), comma-separate them: [R=301,L].
user avatar
  • 243
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 ...
user avatar
  • 21
2 votes

Magento HTACCESS query 301 redirect all but admin

You can try the following: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{REQUEST_URI} !^admin RewriteCond %{REQUEST_URI} !^/index.php/admin RewriteCond %{...
user avatar
  • 1,051
2 votes
Accepted

Redirect from URLs with Query Strings

In this case,you can use event/observer and on event controller_front_init_before fire an observer. First i guess that your old product id and new product id are same. On that observer check query ...
user avatar
  • 75.4k
2 votes

Strange redirect after Magento transfer from an old website to new website

1) Copy all file of site to new host 2) Database setting i. App/etc/local.xml -- Change setting here of new database in new server 3) Url Configuration: Open phpmyadmin find ...
user avatar
  • 4,647
2 votes

Issue with Magento 301 redirect on Nginx

I had a similar problem. Try this... Under System => Configuration, go under General, and select the Web tab. Change "Auto-redirect to Base URL" to No
user avatar
  • 351
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]
user avatar
2 votes

Marketpress to Magento: 301 redirect using htaccess

Assuming category-name varies, then I don't see any way you can do this solely from 301 rewrites in a .htaccess file. You may need to redirect the old URLs to a custom-coded script that will then ...
user avatar
2 votes
Accepted

Bulk import and redirect 301 (over 14K url) in core_url_rewrite or on server

htaccess is good Idea .But it is too tuff write code for 14k urls in a htaccess file, Better idea to rewrite using magento code and that case ,you can use 3rd party extensions like https://www....
user avatar
  • 75.4k
2 votes

Magento 2: Bulk 301 rewrite imports

I had to do this by exporting the url_rewrite database table then added my custom redirects and imported via phpMyadmin and works fine.
user avatar
  • 591
2 votes

Best practices of 404 product page redirection in magento

As of my knowledge, I have been facing similar issues. You can alternately use below steps. First step is, convert or redirect the 404 pages into catalog search results, So that your visitors get a ...
user avatar
2 votes
Accepted

How to do redirect in Magento 2

If you want to redirect from root script, you need to use this try { require_once __DIR__ . '/app/bootstrap.php'; } catch (\Exception $e) { echo 'Autoload error: ' . $e->getMessage(); ...
user avatar
  • 2,055
2 votes
Accepted

Multiple URL Rewrites for the same product is SEO issue?

Multiple URLs explanation: Thanks to Kalvin Klien, as he mentioned in the comment. The Sitemap URLs are crawled by Google. By default the category path is not added in the product URL as the ...
user avatar
1 vote

Magento 2: 301 Redirects

There are a few ways: In the .htaccess or VirtualHost configuration of Apache or nginx A Router observer in Magento that maps a regex of particular patterns to rewrite to the new Magento location ...
user avatar
  • 35.6k
1 vote

magento not following .htaccess rule

In your .htaccess the following should work: Redirect 301 /?htm/147 /someplace You could also look at using a rewrite match redirectMatch 301 ^/?htm/147/?$ /someplace/ If you're going from ...
user avatar
  • 2,212
1 vote
Accepted

301 Redirects dont work with index.php in OLD URLs

It turns out the Redirect directive in an .htaccess file won't match against the query string, only the request uri (the part before the question mark). To match against the query string you'll need ...
user avatar
1 vote
Accepted

301 redirect not working correctly with php in old URL

RewriteCond %{QUERY_STRING} pId=11390&base=1 RewriteRule productdetail.php http://example.com/new-magento-url.html? [R=301,L] That should match the query string you want and perform the redirect. ...
user avatar
1 vote
Accepted

Redirect for urls with filename and query string

You have to use RedirectMatch in order to redirect URLs with parameters. For Example: RedirectMatch 301 /shop.php?id=17299 /target-url.html Put them after RewriteEngine on, but before the ...
user avatar
1 vote

Marketpress to Magento: 301 redirect using htaccess

As @Aric Watson states: you cannot do this with plain .htaccess, because the category-name-slug will not be predictable from .htaccess. But... assuming you're only interested in creating 301's to the ...
user avatar
  • 11.6k

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