So I’ve just migrated a magento store over to a new server.

Gone through the standard setup procedure of copying the html files, updating the host url in the database and modifying my db details in app/etc/env.php.

I’ve also disabled the dev static signing option to prevent the issue where magento looks for assets in pub/static/versionxxxx..

The issue I’m having now is that my index.php loads fine and all looks how it should.

However clicking any link, for example a href to /scarves.php gives me a 404. Not quite sure why as obviously all of my pub and php files are not in the index folder.

How can I go about fixing this, does magento rewrite these links internally somehow?

  • try to run the magento re indexing again on the server. – nishu Jun 18 '19 at 6:49
  • I’ve ran reindexing quite a few times. I’m new to magento but how is it supposed to work when you click a link. Because all of these php pages are not under /<path> and Apache is throwing a 404 because of this. – Adam Jun 18 '19 at 6:51
  • sudo a2enmod rewrite – Prathap Gunasekaran Jun 18 '19 at 6:52
  • I’ve also turned on Rewrite mode for apache, can you provide some insight into how the expected behaviour should work for rewriting the links? – Adam Jun 18 '19 at 6:55
  • @Adam, No need to do any. Just take fresh .htaccess file and upload. Take backup first – Teja Bhagavan Kollepara Jun 18 '19 at 7:10

Even i faced this problem you need to add these lines in your htaccess file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
| improve this answer | |
  • Will that not have a similar issue, if for example I navigate to “products.php” then that rule would rewrite the path to “index.php/products.php” which apache wouldn’t be able to recognise as its not a valid file path. So how would that end up working? – Adam Jun 18 '19 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.