Where to place .htaccess


#1

I host several domains on my DH account. As you guys know each domain points to it’s own folder.

For the time being all I want to do is redirect the 404 page back to the site index.html

I’m assuming I would place the file in the websites directory. Is it possible to place it in my FTP root all the redirects would be to /index.html anyhow.

2 more questions:

Should I place an htaccess in each subdomain folder?

What should the file permissions be on the actual .htaccess file?

Thanks in advance,
Dan


#2

I’m not sure about multiple domains, but yesterday I set up an .htaccess for a custom 404 page, which is working. I put the .ht file in the same (root) directory as index.php. It is supposed to be fetched for every page request in my domain. Be sure to keep it hidden:

<Files .htaccess>
order allow, deny
deny from all

double check that :slight_smile:

hope I helped.

{update: yes, you will need an .htaccess file for each subdomain… see http://listenlight.net/nopage and then http://listenlight.net/thegrove/nopage to be sure }

{update: the file permission listed above will only deny access to the .htaccess file itself, you will need to use multiple entries or regular expressions to deny access to various other files, or simply prohibiting directory listing “Options -Indexes” for a lightweight security measure… google “.htaccess” for better howto’s }


#3

By default, .htaccess access has been stricken within the Apache config, so the above is not needed.

You need a .htaccess file within each document_root. That means, within the root of every domain.

File permissions, just normal. 640 or 644. Doesn’t matter. 640 will also prevent others on the server from viewing your file through the command line.

Best way to redirect for 404 is to use:
ErrorDocument 404 http://www.domain.com/

This will redirect all 404 to the above URL. Just using /index.html will NOT redirect, but just put up “index.html” in place of the file not found.


yerba# rm -rf /etc
yerba#