Helpful Information
 
 
Category: Apache Development
.htaccess

I want to start off by saying this forum is the best thing since sliced bread. Next I recently got rid of plesk on my server because reportedly mod_rewrite .htaccess files don't work with the SSL that is necessary for plesk to run. Now I use webmin and was finally ready to set up my mod_rewrite .htaccess files but now its like my server isn't reading them??? Also when I login via ftp I can see the .htaccess files.....I don't think that is normal as before once uploaded you could not view them. Any idea what's going on and why my server isn't recognizing them and how I can get it to? Something in webmin?

>> but now its like my server isn't reading them???

First check and see if there is AccessFileName .htaccess in your httpd.conf.
Next, say you are trying to access http://www.domain.com/subdir/, check <Directory "/path/to/subdir"> and see if there is AllowOverride None in it, if so, start here -> http://httpd.apache.org/docs/mod/core.html#allowoverride , then change it accordingly. If there is no <Directory "/path/to/subdir">, then check that directory one level up.

Ok thats done, followed your directions perfectly and still the .htaccess files are showing up in the folders and not working???? Any other idea's?

>> still the .htaccess files are showing up in the folders

Browser or FTP? You never mentioned this previously.

What is the problem now? Please answer the following questions since I am totally confused.

1) What do you mean .htaccess is showing up in folder?
2) What do you see if you click on the .htaccess file? BTW, is it visible? Hidden files shouldn't be visible though.
3) Are you getting error? [500]? [403]?

>> set up my mod_rewrite .htaccess files but now its like my server isn't reading them?

How can you tell?

In my first post I said "Also when I login via ftp I can see the .htaccess files" SO to answer your question yes I can see the .htaccess file via my ftp. I did't think that was normal...and figured it might be part of the problem. The rest of the things you said to do in your last thread have all been done and check out. What do you think?

>> I can see the .htaccess file via my ftp. I did't think
that was normal

That was absolutely normal. FTP protocol has nothing to do with HTTP protocol. In particular, FTPd treat .htaccess as a regular hidden file. Some FTPd can hide hidden files and most FTP clients can also select "Do not show hidden files".

Just forget about this and get Apache to recognize .htaccess. Follow the procedure on my first thread again and reply to my question (3) and How can you tell? if you need further help from me.

In addition, answer more questions:

1) What exact URL are you trying to access?
2) Show us the content of all the <Directory> blocks.
3) What is your DocumentRoot?

Thanks now all my .htaccess files for security seem to be working :-) BUT I also want one to stop hotlinking....now if .htaccess files seem to be working than my mod_rewrite must not be working :-( But when I log into webmin it says it is a known module and there is a check mark next to it. Why do you think its now working? Here are the 2 scripts I tried and am sure work cause they work on my friends site.

1
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://animation-central.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.animation-central.com/.*$ [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG)$ - [F]
2
AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^http://www.animation-central.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://animation-central.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://209.217.52.93/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.animation-central.com/
[R,L]

You still haven't replied to my previous questions. Some of them are no longer important but at the very least please reply to this:

Are you getting [500] error now?

I assume your .htaccess resides at http://www.animation-central.com/images/
Check your httpd.conf and see if there is a <Directory "/server/path/to/images">,if not, go one up level <Directory "/server/path/to/">. Within that Directory block, check for options line and make sure you have FileInfo or All, then look for AllowOverride line and add FileInfo to it because Rewrite* Directives in .htaccess need this. Without this, any Rewrite* directives is not allowed to be overriden in .htaccess.

Start here -> http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteEngine and look for Override: FileInfo.

Everything is working perfect now! Thanks SO much for your help couldn't have done it withought you! Know of any good bandwidth monitoring programs? I want to see if I saving as much bw as I thought?

[edited my post because of a stupid error]

Originally posted by freebsd
Within that Directory block, check for options line and make sure you have FileInfo or All, then look for AllowOverride line and add FileInfo to it because Rewrite* Directives in .htaccess need this. Without this, any Rewrite* directives is not allowed to be overriden in .htaccess.
To keep this very interesting topic alive... My host doesn't know so I'm wondering if this is allright:
<Directory /home/sites/site52>
AllowOverride All
Options All
</Directory>

OR is AllowOverride All not good enough and needs it to be AllowOverride All, FileInfo ? Anyone? I'm just getting 403's and 404's.

Okay, I think the AllowOverride All is okay. All things needed are there. Everything is okay, except that my host is using a Cobalt Raq4 and that's probably the reason. Please... does someone know how to fix this?

For some reason my htaccess files stopped working. So I checked my conf and the lines you say should be there are not there. I am not sure where they went. But when I tried to re add them I get an error message that says this line can not be added here. Can you tell me exactly what I need to add to the conf and where to add it. thanks in advance

Anyone?

Just a noobie question, but what happens if there is no AllowOverride in the http.conf for the directory you put the .htaccess file in?

The server would function as if AllowOverride All had been set.










privacy (GDPR)