Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Files without .html extension display as plain text

    Had to change to Hostgator recently as my old webhost is shutting down operations.

    Files like this:

    cotum.com/esoteric

    forbiddenpatterns.com/tme

    used to display fine on my old host. Now they display as plain text.

    How can I fix this?!

  2. #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    TX
    Posts
    3,786
    Thanks
    63
    Thanked 586 Times in 580 Posts
    Add .htm or .html to the file names if they are really HTML text files.

    BTW, welcome to the forums.

  3. #3
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the welcome, but your suggestion is next to impossible. There are so many files, and so many links to change, it would take forever. I would be better off finding a different host that would just display the damn files correctly, as I had before.

    Isn't there something that can be changed somewhere (.htaccess?) to correct this?

  4. #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    TX
    Posts
    3,786
    Thanks
    63
    Thanked 586 Times in 580 Posts

    Question

    Have you asked your ISP if there is a fix for your problem?

  5. #5
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, talked to them and they mentioned something about .htaccess but maintain it's not their problem. Ridiculous how ALL these worked without issue on successfulhosting.com, but now none of them will work.

  6. #6
    Regular Coder
    Join Date
    Sep 2010
    Location
    U S of A
    Posts
    244
    Thanks
    4
    Thanked 43 Times in 43 Posts
    Quote Originally Posted by SupremeJabar View Post
    Had to change to Hostgator recently as my old webhost is shutting down operations.

    Files like this:

    cotum.com/esoteric

    forbiddenpatterns.com/tme

    used to display fine on my old host. Now they display as plain text.

    How can I fix this?!
    set the headers on the server with php

    something like this maybe (just a guess really)

    <?
    header('Content-Type: text/html; charset=utf-8');
    ?>
    Last edited by Shaka Zorba; 11-11-2017 at 10:37 PM.

  7. #7
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, what do I name the PHP file, where to place it, etc?

  8. #8
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,872
    Thanks
    6
    Thanked 1,299 Times in 1,269 Posts
    Quote Originally Posted by SupremeJabar View Post
    Yes, talked to them and they mentioned something about .htaccess but maintain it's not their problem. Ridiculous how ALL these worked without issue on successfulhosting.com, but now none of them will work.
    Strange that nobody here responded to the mentioning of htaccess; this came to my mind right after just reading the thread title and is exactly what is needed here, I presume. It would have been easier for you to just type “remove html extension htaccess” into a search engine of your choice rather than register here and start a new thread, since there are numerous articles explaining this, but since you’re here now I might as well do the searching for you. This came up as the first result: https://alexcican.com/post/how-to-re...with-htaccess/

    You create an htaccess file and put it into the root of your website. Most likely there was a general server setting with your old host which is why you didn’t have to do that manually.

  9. #9
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. I found the .htaccess file on HostGator and followed the instructions:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^\.]+)$ $1.html [NC,L]

    Now, I can access 'index.html' just by typing "index."

    But this:

    cotum.com/esoteric

    still will not load properly.

    This is beginning to seem hopeless. I guess I need to find a webhost who has sensible settings in place, instead of this garbage.

  10. #10
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tried

    Options +MultiViews

    with and without the above. Still doesn't work.

  11. #11
    New to the CF scene
    Join Date
    Nov 2017
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, I found if I rename the files with a .html extension, the above DOES work. Now I just have a lot of files to rename.

    Thanks everyone for your help.

  12. #12
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,872
    Thanks
    6
    Thanked 1,299 Times in 1,269 Posts
    Quote Originally Posted by SupremeJabar View Post
    But this:

    cotum.com/esoteric

    still will not load properly.
    Seems to work for me. Perhaps a caching issue? Clear your cache and try again.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •