.htaccess Error please help! [ERROR 404]

Hello there. I made the SSL settings in infinity free, but now I want it to redirect http directly to https from my .htaccess file. I tried a lot of code but after doing all of them I click somewhere and it gives 404 error please help me.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

this is the only working .htaccess code. Here it redirects to http. Even if I try all https or redirect codes, they all give 404 errors.

Follow this guide:

2 Likes

not working in this code

Use this code:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Then clear your cache. If it is still not working, share your domain name and the entire contents of your .htaccess file.

1 Like

I’m sorry dude, but this doesn’t work, I tried many times and even deleted and reopened your file.

Then follow the rest of my post:

Domain name : flwus.com

And…

.htacces

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Its working, so you need to clear your cache or try a different browser. Your ISP may also be caching it, so try using a different device.

Dude, the homepage works, yes, but when I click on one of the categories, it gives a 404 error, I tried it from other devices and browsers.

I have no idea how to solve

Oh, I should have re-read the title, sorry.

Your .htaccess code is file, a 404 error means the page cannot be found. Remember that names must be excatly the same!

So. “hello.html” IS NOT THE SAME AS “Hello.html”

I’ve been looking, but I can’t find such a faulty file.

Its not one file, its all your files. Your links lead to filenames with no extensions that do not exist. Please screenshot the filemanager.

Which links return a 404 error? I checked https://flwus.com/ but there is only one landing page there as far as I can tell. I don’t see the categories you are referring to.

I think he means all the hyperlinks in the navbar

Which navbar? I only see a page saying “Coming Soon”, with no links or buttons on the page.

He changed it, it looked completely different before.

Oh I’m sorry. The site wasn’t like that yesterday, I changed it, now I’m going to do it again like yesterday.