2

I am running Magento 2.1.14 and have a version installed on my local machine as well as a live server. Both machines are running Apache 2.2. On my local machine I installed php 7.0.31 and on the live server (shared hosting) I am using php 7.0.31 for my domain. The default setting for the live server is php 5.6. I have SSL setup on both and run through https. I have mod_rewrite enabled on both servers as well.

I have the same htaccess file on both hosts and an identical file tree. They are identical copies of each other, except for the base and secure URL's. When I navigate to a literal URL on my local machine, it shows the proper page. But when I navigate to the literal URL on my live server, it gives me a 404 page.

EDITED For Example:

https://127.0.0.1/magento.com/testDirectory/phpInfo.php

Where [magento.com] is the name of the directory where my magento store is installed, will show me the page.

BUT

https://magento.com/testDirectory/phpInfo.php Where [magento.com] is my domain, will throw me a 404 page.

I don't have a large .htaccess file and I'm posting the rewrites section below to see if anyone might be able to tell me why I can view the literal path on my local machine, but my live server is showing me a 404. Also, which action is correct (showing me the page, or throwing the 404), based on my htaccess file.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
#added below redirect rule for wordpress - redirects for posts
RewriteRule ^.(\d{0,4})/(.*)$ /blog/$2 [L,R=301]
#added below redirect rule for wordpress - because we deleted the blog category
RewriteRule ^blog/category/blog/(.+)? /blog/$1 [L,R=301]
#added below redirect rule for wordpress - removed catgegory tag in uri
RewriteRule ^blog/category/(.+)? /blog/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
8
  • If magento.com is directory second example don't have full address. It's like directory/testDirectory
    – BartZalas
    Sep 21, 2018 at 22:54
  • Could you clarify? That didn’t make sense. Second example has the full address.
    – Jason
    Sep 21, 2018 at 22:55
  • your example is different 1. localhost/directory... and 2 is directory... (should be domain/directory) When You add rewrite it will be only localhost and domain.com without magento directory
    – BartZalas
    Sep 22, 2018 at 9:52
  • Bart, gonna edit, sorry, the first example [magento.com] is a directory name on my localhost. It’s where my magento is installed. On live server [magento.com] would be the actual domain.
    – Jason
    Sep 22, 2018 at 10:04
  • Hi Jason Did you try to experiment with RewriteBase? Check also settings what is your default webroot in apache2 /etc/apache2/sites-enabled/000-default /etc/apache/apache2.conf
    – BartZalas
    Sep 22, 2018 at 10:19

1 Answer 1

1

You wrote that all your files are in directory magento.com

so add this:

RewriteBase /magento.com/

or

RewriteBase /var/www/html/magento.com/
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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