Hide index.html file extension if manually typed

If someone goes to upload.rydercragie.com/index.html, is it possible to redirect them to upload.rydercragie.com and remove the file name from the link? Thanks.

Please try searching the fourm before posting.

How Do You Remove .html , .php

In that case, it will show “index”, which isn’t what I want. I want nothing after “/” if someone manually types “index.html”.

A web search would have gotten a quick answer to that question.

Add this to your .htaccess file:

RewriteCond %{THE_REQUEST} /index\.html? [NC]
RewriteRule ^(.*/)?index\.html?$ /$1 [R=301,L]
2 Likes

Or you can add the following 301 redirect rule in you .htaccess:
Redirect 301 /index.html upload.rydercragie.com

1 Like

That won’t work, it will end up with an endless redirect loop.

1 Like

Eh, I think it might work. If the Redirect rule acts on the request URL, and not the file, then it should redirect the URL /index.html to /.

1 Like

I might try it. But the only thing stopping me is the fact that it takes a while for these changes to take effect. For example, I recently set up something which will allow me to access files without entering the extension. So you should be able to go to upload.rydercragie.com/thank-you without having to add .html, but it doesn’t seem to be working yet — with or without the extension. It’s been about a day already.

Two things: Either your .htaccess file isn’t working correctly (logic error, most likely) OR you need to clear your cache.

Try clearing your cache first.

2 Likes

This is the file. I don’t remember it being this messy before. There’s stuff all over the place.

If I’m not mistaken, lines 3 and 4 are to hide HTML extensions.

Lines 6 and 7 is what I was told to add in this forum.

Lines 9-12 are to force all http traffic to https.

Lines 14-18 are error page redirects. (Which is what everything is redirecting to at the moment, even if it’s a valid file path.)

But maybe there’s too much or they’re in the wrong order?

It works well for me.

Try clearing your cache.

2 Likes

Ugh. Browser cache. The worst thing to ever exist.

Even after clearing the cache it won’t work. I’m pretty sure my ISP are caching it, but even on mobile data it won’t work. What I see a lot of in this forum is that people say it works fine for them, but never for me. Yes, “index.html” is now removed from the link if manually typed, but the other problem is still occurring.

Are you 100% sure that upload.rydercragie.com/thank-you takes you to a page which says “Thank you!” with a green envelope image? If so, can you please share a screenshot where I can see the address bar and the page at the same time? Because for me it just seems to redirect me back to upload.rydercragie.com.

upload.rydercragie.com/thank-you does redirect back to upload.rydercragie.com. Remember that you can also use a VPN and a private tap to bypass all cache.

But also note that http://upload.rydercragie.com/thank-you.html also redirects back to http://upload.rydercragie.com

I did the mainpage and not thank-you, but now when I tried it it redirected me back to the mainpage, as well as trying thank-you.html (with the same result).

How can I fix that?

I don’t really know, I am not that good with .htaccess :confused:

Try asking Greenreader9 :slight_smile:

2 Likes

@Greenreader9

Does “thank-you.html” exist? Is there a restriction (Not in .htaccess) that is restricting access to the page (Since 403 also redirects home). I can’t access dev tools on the laptop I am currently on, so I can’t say anything for sure. I don’t however think this is an .htaccess issue.

When I submit the forum, I also get redirected back to the form page after the captcha is complete.

Yes, it does exist. How would I check if there’s a restriction? Bear in mind that when I tried this with files.rydercragie.com I had the same issue.

It looks like upload.rydercragie.com/anything-at-all-here redirects back to upload.rydercragie.com. You must have a redirect or restriction somewhere. Maybe in the control panel or Cloudflare?