Forum Moderators: phranque

Message Too Old, No Replies

.htaccess on a virtual server - can it be done?

I'm betting the answer is "yes, but..."

         

bellrj

1:26 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



Thought I might try here because the answer would be much quicker than with my web host. ;) I have a web site on a virtual host (Apache, Unix) so I can ftp, chmod files, and add a robots.txt but that's about it. I don't have access to the Apache server configuration files or directories; no shell access; no cron jobs, etc. I've been looking at the .htaccess documentation which seems to suggest that I can just place .htaccess files in any of my web site directories and voila! Is this true for virtual sites or do I need access to the Apache directories or configuration files too?

Nick_W

1:28 pm on Oct 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried it?

>true
yes, if the server allows it

Nick

bellrj

2:01 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



Not yet. I didn't fancy just 'trying it' on a live web site without hearing from the experts. I also need to find out what a safe test could consist of. I don't want to mess things up by unintentionally disabling access to any part of the web site.

'if the server allows it' - I take that to mean that an Apache configuration can be set to disable lower level htaccess files?

bondjamesbond

3:28 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



While I am a .htaccess beginner, my site is run on a virtual server. After reading about .htaccess on this forum I decided to just give it a try to see if the server supported it, and if it worked.

For my first test I just put in one line :
Options -Indexes

This stopped people viewing a directory listing of folders.

kevinpate

3:29 pm on Oct 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's possible.

Whether it's possible with your specific host
company is a Q that's best addressed to them.
(And if they say no, it's time to consider a new
host in my opinion, bu that's a different thread altogether.)

jetboy_70

3:40 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



Try anything (within reason). It'll only effect directories downstream from where you put it, and you can reverse all effects by uploading an empty .htaccess file over the top of it (or deleting it if your FTP client can see the file - some can't).

bellrj

3:53 pm on Oct 9, 2003 (gmt 0)

10+ Year Member



bondjamesbond - that sounds like a good test. I shall give that a go.
kevinpate - I see where you are coming from! ;)
jetboy_70 - You've given me a good idea there. I can just create a new empty directory structure somewhere and use that for testing in conjunction with bondjamesbond's idea.

As soon as I get home I shall give these things a try so thanks everyone. I'm hoping that the passwording features will work well as that will save me having to use PHP and MySQL just to protect one page. Sledgehammer and nuts come to mind... Any other cool ideas for using htaccess will be appreciated. (I'm getting all excited in a techie type way - I just hope it works now! :))