Remove www and index from domain

domallen.com

Error Message

404

Other Information

I’m getting a 404 error message when I just try and type domallen.com.
I have to type www and /index to load the site. How do I load the site without the www and hide the file name extension. I’ve tried this with htaccess but can’t get it work properly.

Thanks

hmm, you’re using CloudFlare. You can add CNAME for your main domain as described here:

4 Likes

What do I need to put for Target?

8 random-character main domain. You can find it in client area

3 Likes

Sorry I’m a bit confused, the client area where?

app.infinityfree.net/accounts/

3 Likes

At https://app.infinityfree.net/accounts, select the website you mentioned here, and under Account Details, there is a section that says ‘Main Domain’. It will look something like this: xxxxxxxx.epizy.com.

In the Cloudflare DNS Section, click add a new record, change the type to CNAME, put the host as @ and the target as the domain found in the Client Area.


If you want to remove file extentions, add this to your .htaccess code:

Options -Indexes +MultiViews +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\index [NC]
RewriteRule ^ %1 [R,L,NC]
4 Likes

and if you want to remove www

remove www

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domallen.com [NC]

RewriteRule ^(.*)$ http://domallen.com/$1 [L,R=301]
change the http:// bit to https:// if you have ssl

3 Likes

Thank you for you help everyone. I’ve done all of the above but 'm now getting an error that says:

This site can’t provide a secure connection

domallen.com sent an invalid response.

ERR_SSL_PROTOCOL_ERROR

I also have this CNAME flattening thing (see screenshot) does that matter?Screen Shot 2021-02-11 at 10.55.34

And I’m still getting a 404 error, argh!!

Screenshot CF dns entry

Press on the grey cloud to make it orange cloud for both CNAMES

3 Likes

for a certificate you have to be inside the orange cloud


And why do you still have 404

the problem is in your .htaccess
which undoes the default .htaccess
which seeks to serve index.html as the home page

You delete the extension and it can’t find that file



VS

2 Likes

FlutterHoney said it needed to be grey?

What code do I need to remove the index.html from typing it in and just using domallen.com I tried the code above but it’s not working

This is my htaccess file

1 Like
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]

I still get a 404