0

I was fiddling around with the .htaccess in my web hosting directory, attempting to force HTTPS to my URLs to activate my SSL that comes with Hostgator (which did in fact work), but after changing stuff in there and whenever I try to access my page by simply typing in the URL bar examp.com the browser automatically adds public_html after it, which results in a 404, and only when I remove the public_html part of the URL am I able to access the HTML documents and folders. But if I type https://www.exampe.com THEN it works properly without adding anything. I was unable to find anything regarding this problem and it happens with every browser.

My .htaccess file looks like this:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 

Even after removing it the problem persists.

EDIT: The foulder structure is home3/example/.htaccess

EDIT: I should probably mention this, when I originally edited the .htacces file in the first place it was not present, literally nowhere in my hosting directory on Hostgator, not even after checking "Show dotted files", so I ended up creating it manually and then I started fiddling with the code above.

Vortic
  • 1
  • 1
  • Are you sure that there is no other `.htaccess` doing the rewrite? – nice_dev Feb 25 '19 at 12:54
  • I don't know, but that might be the case, since when I initially looked for my .htaccess file I was unable to find it anywhere (even after ticking "Show dotted files") so I ended up creating a new one at the base directory above all others in the cpanel. – Vortic Feb 25 '19 at 12:58
  • Can you share your folder structure by editing your post? Where is your `.htaccess` file? Inside `public_html` or outside of it? – nice_dev Feb 25 '19 at 13:00
  • 1
    Anyway, the differences you see between example.com and https:̸̸̸̸̸̸̸ ̸ example.com are because https doesn't use port 80 and is therefore unaffected by the rule. – Mr Lister Feb 25 '19 at 13:05
  • So how do I proceed to resolve this issue? – Vortic Feb 25 '19 at 13:08
  • @Vortic so does `home3` have any `.htaccess` of itself or anything outside of it? – nice_dev Feb 25 '19 at 13:19
  • It has nothing outside of it and it has no .htaccess other than the one I manually created. Also, deleting it doesn't solve the issue. – Vortic Feb 25 '19 at 13:42
  • Have you restarted Apache since changing the .htaccess file? – Mr Lister Feb 25 '19 at 13:52
  • The hosting is "Shared hosting" on Hostgator, I can't restart Apache. – Vortic Feb 25 '19 at 13:56
  • Please go through it.. https://stackoverflow.com/questions/10489895/http-to-https-through-htaccess – Somnath Mondal Feb 25 '19 at 14:09
  • Absolutely NONE of these worked, I went through the whole thread. – Vortic Feb 25 '19 at 15:10

0 Answers0