MAR
MAR

Reputation: 613

Forcing HTTP to HTTPS causing 404 error

I have a website based on WordPress, and one section of it is built by external programmers (the backend). I was able to force all connections to go on HTTPS instead of HTTP using a plugin for the WordPress part, but for this specific area which isn't WordPress-based I had to do something else. My knowledge is restricted so I just googled it and found I should create an .htaccess file inside the specific folder with the following:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} folder 
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

I did just that, and now when I'm trying to access that area, it says it doesn't exist (404 error):

The requested URL /backend/auth/login was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

The weird thing is, when I try to access directly the link The requested URL /backend/index.php, it does work and redirects me to:

/backend/index.php/auth/login

I don't know how to fix it or what to do but actually I don't see an "auth" folder in there, but it works under index.php

In addition, when trying to reverse what I did, I deleted the .htaccess file, but it still isn't working, which is really weird.

Any ideas?... Thanks!

Upvotes: 1

Views: 1997

Answers (1)

Alexis Ochoa
Alexis Ochoa

Reputation: 136

You can not delete the .htaccess file because it is used by wordpress for all HTTP and HTTPS redirects.

This error does not seem to be by HTTPS. It seems that Wordpress url does not exist or can not translate it. Try these things:

  1. Recover the original .htaccess and retests the URL
  2. Modify the URL in the database. Remember that Wordpress keep them there.

Upvotes: 1

Related Questions