cancel
Showing results for 
Search instead for 
Did you mean: 

404 error on every page except homepage on CentOs 7

SOLVED

404 error on every page except homepage on CentOs 7

Hi there,

I'm experiencing something strange.

I have Magento 2.3.4 running on a CentOS 7 server with DirectAdmin with Apache2. I can access my homepage but I can't access all of the other pages (category, products and cms pages)

When I disable the url_rewrite config, I can access pages by prefix the path with index.php/<category>.

Things I have done:

  • Checked my .htaccess file. Mod_rewrite is enabled. (original Magento settings)
  • Ran CLI commands like: setup:upgrade, setup:static-content:deploy, setup:di:compile etc.
  • Flushed all caches

I'm out of idea's. Does anyone has idea's how to fix this?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: 404 error on every page except homepage on CentOs 7

Ok, I just found the problem. What happend?

Before A ran Magento from the servers public web-directory. In my case public_html.

I decided to create a directory called 'magento2' as a sibling of public_html.

Than I've made symbolic links in public_html from the contents of the magento2/pub/ folder.

I did this wit:

ln -f magento2/pub/* public_html/

This made all of the correct sym-links accept the .htaccess file.

 

So I finally ended up with adding the sym-link for the .htaccess file by:

ln -s magento2/pub/.htaccess public_html/.htaccess

After flushing the cache and reindex the indexes everything worked fine.

 

View solution in original post

1 REPLY 1

Re: 404 error on every page except homepage on CentOs 7

Ok, I just found the problem. What happend?

Before A ran Magento from the servers public web-directory. In my case public_html.

I decided to create a directory called 'magento2' as a sibling of public_html.

Than I've made symbolic links in public_html from the contents of the magento2/pub/ folder.

I did this wit:

ln -f magento2/pub/* public_html/

This made all of the correct sym-links accept the .htaccess file.

 

So I finally ended up with adding the sym-link for the .htaccess file by:

ln -s magento2/pub/.htaccess public_html/.htaccess

After flushing the cache and reindex the indexes everything worked fine.