Blank htaccess file

Just curious really:

I have just uploaded a new site and I notice that my host gave me a .htaccess file in my root folder but there doesn’t seem to be anything in it. Is it doing any harm being there?

Thanks

No, it doesn’t do any harm. You can delete it if you don’t want it. :slight_smile:

Thank you.

Though it might be more useful if you put it to work.

What would be useful to use it for?

For one, this line

Options -Indexes

will ensure that if someone requests a folder that doesn’t have an index page, (ie. www.domain.com/scripts/) they won’t see a directory listing of the folder’s contents.

You can also use it for custom Error 404 pages (page not found). Just design your custom error page and upload, then add the following code directing the browser to the error page.

ErrorDocument 404 /notfound.html - just change the red text to the name of the page you uploaded.

Other Error Codes include:

401 - Authorization Required
400 - Bad request
403 - Forbidden
500 - Internal Server Error
404 - Wrong page

Good luck,

RedlineVision

haha… google for .htaccess and you’ll see 100’s of excellent things that this little file will do for you and your visitors

Hi, I had just installed PHP-Nuke but my host refused all my .htaccess files which was included in the installation. Is this ok?

The site will still work without .htaccess files. The host probably has their own error pages etc…

Good luck,

RedlineVision.com

.htaccess can be very useful to fine tune your urls, or parse .html pages as .php pages as well. Often useful :wink:

I cannot imagine hosting a project on a host that doesn’t allow my to use a .htaccess file. I don’t know what you use it for and how is designed your project, but I would get a new host.

:slight_smile:

HTACCESS is like a gift from heaven. :agree:

Here’s another quick thing you can do (originally posted by stymiee in the SEO FAQ):


RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\\.domainname\\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]

That will add the www. prefix when the site is requested without it. :slight_smile:

Or the other way around:


RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\\.domainname\\.com$ [NC]
RewriteRule ^(.*)$ http://domainname.com/$1 [R=301,L]

:slight_smile:

Which one is better, in your opinions?

Grump

It may be that the httpd.conf file doesn’t allow use of htaccess files. Or it may be that PHPNuke wanted to over-write existing htaccess files. If you look for htaccess files and find them, you should be able to edit them if you want too.

Yes, that would be the most likely thing. Anyway, I tried to open that one and “DENY ALL” is all that it contains. Maybe I’ll just have to suffer a little security risk but it,s ok and PHP Nuke still works.