Web Hosting Talk







View Full Version : XTR and .htaccess problem - need help!!!


akvitka
08-09-2002, 11:57 AM
I have a problem with getting an .htaccess file to work on my new XTR box. As I am new to the Linux world, I’m hoping someone can either help me determine what the problem/fix is, or fix it for me (I will pay of course). Here is the summary.

I am trying to create a .htaccess file that will do 3 things. I've gotten 2 of the things to work, but not the last. I have a feeling that the problem is with the say XTR box is configured and not with how the .htaccess file is written. Let me set the stage.

One of the clients that I am hosting on the XTR is running tons of images and has asked me to help him fix the .htaccess file because his images are being hot-linked. So I created the following file (see below), and uploaded it to his /web/ directory of his domain. Two of the things the file is meant to do are working - 404/403 re-directs, and disabling directory browsing. Hot-linking is still allowed.

Based on help from documentation and Sun Support Forum, I went into the access.conf file and changed all instances of AllowOverride None to AllowOverride ALL, then restarted the server. And I also followed all the other rules such as, upload the file using ASCII mode, etc.

So my guess is that there is something else in the way Sun has configured the XTR to prevent certain .htaccess features to function. On the other hand there may be things that I need to do in the site settings that are not discussed in the documentation or the knowledge base.

I am willing to give an expert complete access to the XTR if they would be willing to telnet into it and try to figure out where the problem is. Of course I will pay and would love to know what the problem is and how it was dealt with it.

Thank you in advance.
Andre

----------------------------------------------------------------------------
AuthPAM_enabled off
IndexIgnore *

AuthUserFile /dev/null
AuthGroupFile /dev/null
Options +FollowSymlinks
ErrorDocument 404 http://www.domain.com/index.html
RewriteEngine On

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^.* domain.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://1.1.1.1.*$ [NC]
RewriteRule .*\.jpg$ http://www.domain.com/index.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^.* domain.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://1.1.1.1.*$ [NC]
RewriteRule .*\.gif$ http://www.domain.com/index.html [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^.* domain.com.*$ [NC
RewriteCond %{HTTP_REFERER} !^http://1.1.1.1.*$ [NC]
RewriteRule .*\.qt$ http://www.domain.com/index.html [R,L]
AddType text/x-server-parsed-html .htm

Of course the IP and domain substituted in the real file.

mas1010
09-06-2004, 04:26 AM
Hello,

My name is Mario Salinas. I have an xtr as well and was wondering if you had gotten any reply to your question regarding an .htaccess file.

I'm simply trying to get the xtr to request a username and pw for a specific directory. I've been reading about htaccess files all over the web and everything these sites suggest I try without success. Have you learned if the XTR has any strange programming that won't let regular htaccess files work?

Any help is appreciated.

Thanks,

Mario A. Salinas
818-209-8643

racksense
09-06-2004, 07:34 AM
* Edit: I didn't realise how old the first post was!

Andre,

It could be that your Apache does not have the mod_rewrite module, check the httpd.conf to make sure that module is either being loaded or enabled.

Also, try adjusting your rewrite rules to something like this:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://test\.example\.org [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://images\.google\.com [NC]
RewriteCond %{REQUEST_URI} !^/stolen.jpg
RewriteRule \.(png|PNG|gif|GIF|jpg|JPG)$ http://www.domain.com/stolen.jpg [R,L]

Ordering is important. The rewrite rule should point to a stolen.jpg or similar that replaces the image with another if it has been hot linked without permission.

racksense
09-06-2004, 07:38 AM
Mario,

you probably need 'AllowOverride AuthConfig' for the directory where you are trying to set password protection.