Monday, May 24, 2010

How can I use a.htaccess in my Unix home directory which makes homepage.html the default loaded document?

I want to create a plain text file called .htaccess in my Unix home directory which makes "homepage.html" the default loaded document a browser goes to when searching my document root directory on your Web server.


would you please help me, what is the code I should put in the text file?


Thanks

How can I use a.htaccess in my Unix home directory which makes homepage.html the default loaded document?
.htaccess is used to password protect a directory, not to set the default file name for a directory. This is something you have to do from your web server (which one are you using? Apache?).





The Apache help files should tell you how to set up your default file names. "index.html" is usually the standard default.
Reply:If you have the proper rights delegated to you for your home directory, the Apache directive for your htaccess file is:





DirectoryIndex homepage.html





(you need AllowOverride Indexes (or all))





The alternative is to use mod_rewrite, which requires a different override.





RewriteBase /~youruser


RewriteRule ^$


RewriteRule homepage.html





(The rewrite is a little weird because in .htaccess, a request for just the current directory is actually an empty match)





note: depsite previous posters answer, htaccess is not tied to authentication.


No comments:

Post a Comment