Type domain.com/bike and get to domain.com/bike/index.html, what's wrong?

5 replies
  • WEB DESIGN
  • |
I don't even know the domain involved. This was just a question by the contact form from a site, and that was the example that was given. She said someone had advised her to sort it out with .htaccess and she is working on that.

It just sounded interesting to me, and I've seen that at times, but can't remember which sites. Is there a basic setting with a host that could be tweaked to just have domain.com/bike show up in the address bar, instead of domain.com/bike/index.html? (had to edit this a bit)

thanks for your time
#domaincom #domaincom or indexhtml #type #wrong
  • Profile picture of the author kokopelli
    No, you usually have to add something like this to the .htaccess file:

    Code:
    RewriteRule ^([^.]+)$ $1.html [NC,L]
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5510396].message }}
  • Profile picture of the author Lloyd Buchinski
    In what situation would I have to add something like that koko? I've never done it for any site I've worked on, and have never had the index.html show up in the address bar.
    Signature

    Do something spectacular; be fulfilled. Then you can be your own hero. Prem Rawat

    The KimW WSO

    {{ DiscussionBoard.errors[5510439].message }}
  • Profile picture of the author kokopelli
    The rewrite code I gave before is for a single HTML website, there's different .htaccess directives for a PHP site.

    If you have admin privileges on your Apache server, you can also add a similar directive to httpd.conf to remove "index.html" for all your websites on that server.

    If you use a CMS like WordPress, chances are the permalink structure already removes the "index.php" part. That's probably why you haven't seen it.
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5510504].message }}
  • Profile picture of the author Lloyd Buchinski
    I use both html and php pages but not Wordpress except to tinker with about once a year. None of the sites had any .htaccess files until I needed them for something. I then created them to take care of a few small jobs, but getting rid of index.html wasn't one of those jobs. It was never needed.

    In what situation would it be needed?
    Signature

    Do something spectacular; be fulfilled. Then you can be your own hero. Prem Rawat

    The KimW WSO

    {{ DiscussionBoard.errors[5510548].message }}
  • Profile picture of the author kokopelli
    Dunno, each server setup is different, server OSs are different, your website may have a particular configuration, etc., and I do not have enough information to give you a better answer atm.

    Maybe the default documents on the server (index.html, index.php, index.htm, default.htm, etc.) have been disabled, but directory browsing is enabled, so the site can be viewed without the "index.html", etc.
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5510692].message }}

Trending Topics