Web Hosting Talk







View Full Version : How to make page.htm act as index


hostseeker
10-13-2001, 02:14 PM
Say if I had a file called page.htm in the root directory of mydomain.com like this mydomain.com/page.htm

How can I make the server treat page.htm like a subdirectory, in that it would serve page.htm if mydomain.com/page is specified in a browser and there was no actual "page" subdirectory under mydomain.com?

I was with a virtual host once that had it set up like that and it was convenient. Now with my dedicated it does not do that and I want to change it.

Thanks!

eva2000
10-13-2001, 02:18 PM
just use a .htaccess file with

Redirect /page /page.htm

slade
10-13-2001, 03:09 PM
edit: error, didn't read problem...

hostseeker
10-13-2001, 05:23 PM
Eva,

I am sorry I did not make myself clear.

I want ANY page to be read as if it were a subdirectory (or actually the index page of a subdirectory) IF a subdirectory doesn't exist by the same name.

Examples:

Type in browser: mydomain/pagetwo

If mydomain/pagetwo/ does not exist then mydomain/pagetwo.htm will be displayed.

Thanks for your help.

eva2000
10-13-2001, 06:41 PM
not sure but you might need to use mod_rewrite and htaccess file for that... unfortunately i don't know much about mod_rewrite besides the basics :o

The Prohacker
10-13-2001, 08:48 PM
You might try:

RewriteEngine on
RewriteRule ^/([^/]+?)$ /$1.htm [L]






All pages would have to end with .htm.....
I didn't get a chance to test it but it should work....