.htaccess Hide file name in URL


I was wondering if there is anyway we can hide file name in the URL using .htaccess ?

For example

These URLs:


Should look like


If the visitor wrote the file name and extension correctly,
I want a 404 error page to appear

Pls let me know if this is possible and how?

Many thanks

Assuming that the file are arranged as such that contact-us.html is in a directory named welcome and email_us.html is in a directory named support, this can be done by setting a DirectoryIndex for each directory. Eg:-

DirectoryIndex home.html

There are other ways using rewriting that yo may need, depending on the site structure.

All pages of my website are in html
For this
If you know a code or method, let me know :monkey:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.