404 File Not Found when attempting to access /admin

Keywords: Magento - Google Cloud Platform - Technical issue - Secure Connections (SSL/HTTPS)
bnsupport ID: f2909a42-173c-e96a-15bc-bf72a5fe1c8f
Description:
Getting 404 Not Found error when attempting to access /admin

Checked base url’s, cleared cache, reindexed, restarted machine….nothing.

I have succeeded on occasion by setting the base url’s to the site’s IP address, but even that solution doesn’t last. As soon as I try a second time to get into /admin, I receive 404 File Not Found.

Possibly related: Suddenly we’re havnig CORS Access Control errors. Each page has a dozen or so, of the form:

…frontend/Mgs/claue/en_US/fonts/Pe-icon-7-stroke.woff?d7yf1v’ from origin ‘…’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I have tried every suggestionI could find online, modifying htaccess.conf, even installing a Magento extension, but again to no avail. I had it fixed on one site at one point, then it became unfixed again.

I would very much appreciate some help. Not sure where to go from this point.

Url’s: mountjoy.co/admin, hiskwey.com/admin 54.69.108.125/admin.

Alex

Hello @a_mountjoy,

Could you please try the solution provided by my colleague in the following thread:

Regards,
Francisco de Paz

Thanks for the suggestion. The base url should be fine, at least it looks so in the table:

Alex

I believe it has to do with non-www to www redirection which I enabled via bncert-tool when I recreated the letsencrypt certificates. Now I’m trying to figure out how to disable that redirection.

Solved:

In the bitnami/bitnami conf file, under :81 and :443 sections both, instructions generated by the bncert-tool to direct non-www traffic to www were still present. I removed them, and replaced them with instructions to route www to non-www, and the 404 File not found errors went away, because there were no longer any www requests being made.

I also removed the “http” to “https” redirection, also added by bncert-tool, but I’m not sure that was a factor.

In and blocks add:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1$1 [R=permanent,L]

(At first I tried putting these instructions in the :81 block only, and all pages worked except the home page, which continued to force to www. Adding instructions to :443 block took care of this last problem.)

The CORS errors were a function of the non-www to www redirection. Once I made sure all requests were routed to non-www, the CORS Access-Control-Allow-Headers errors went away.

Hello @a_mountjoy,

I’m glad you could solve the issue and thanks for sharing the solution with the community! I’ll be closing this thread now. Please open a new thread if you encounter any other issues in the future.

Regards,
Francisco de Paz