.Htaccess -- editing after Dreamhost created it?


#1

I am trying to stop image linking from one of my sites (http://fab4lyrics.stonegauge.com ) and trying out the .htaccess feature. The problem is I don’t know how to edit the htaccess file after it’s created so the images will at least show up on the web pages they are supposed to instead of on wayward web sites…

I’m not that great with shell and stuff so treat me as a n00b when you answer…

Thanks,
John


#2

You can add this to your .htaccess file:

# deny hotlinking RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://stoneguage.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.stoneguage.com/.*$ [NC] RewriteRule .*\.(png|PNG|jpg|JPG|gif|GIF)$ - [F]It is not a foolproof solution, but it will be better than nothing. I use it with reasonable success. You may need to add a line that includes your subdomain, but I doubt it.


Simon Jessey
Keystone Websites | si-blog


#3

Simon –

HOW?

I used WS_FTP to get the .htaccess file. I edited it follwoing specifications from both the dreamhost knowledge base and from another web site… I tried to upload the .htaccess file back to the /images directory and I wasn’t allowed to do it for one reason or another…

As of right now I’ve screwed up and the images on my site aren’t showing up because of the faulty .htaccess file… I tried deleting the file (through the control panel) but I believe it’s still there.


#4

It goes in the root folder - the same folder that your main home page is located. The path should be:/.htaccessHaving an .htaccess file in your images folder may cause problems. And forget using the control panel for FTP. Use your preferred FTP client. Mine is SmartFTP.


Simon Jessey
Keystone Websites | si-blog


#5

Well an .htaccess file affects all directories above it in the filesystem… so where you put it depends on what you’re trying to do. There isn’t one “right place” to put it.


#6

Surely the .htaccess file affects all directories below it in the file system?

In order to prevent “hotlinking”, the mod_rewrite code I gave needs to go in the root web directory (where your home page goes).


Simon Jessey
Keystone Websites | si-blog


#7

You mean where all the directories are listed for the sites or you mean the root web directory for the sites (fab4lyrics.stonegauge.com)?