Block Search Engines and Every Thing Else - .htaccess

I'm using a program called ShareX which will upload screenshots I take to my web dir via ftp example: https://website.com/screenshots/
I need a way to block search engines and everyone else from browsing the screenshots dir and showing up in google images etc but have direct links work fine when I upload a screenshot to share with someone. (https://website.com/screenshots/screenshot01.jpg)
I don't upload anything super sensitive but would like the piece of mind that its off limits to everyone who doesn't know the direct path to an actual image.
Thanks for any help with this.

Disable directory indexes (assuming you're running Apache)
# .htaccess file in your screenshots/ directory
Options -Indexes
Use a robots.txt. Every reputable search engine will obey it.
Use a CAPTCHA (a little extreme in my opinion).

Related

How to use locations.kml with sitemap.xml

I would like to make sure website ranks as high as possible whenever my Google Places location ranks high.
I have seen references to creating a locations.kml file and putting it in the root directory of my site. Then creating lines in the sitemap.xml file to point to this .kml file.
I get this from this statement on the geolocations page
Google no longer supports the Geo extension to the Sitemap protocol. We recommmend that you tell Google about geographically-based URLs by including them in a regular Web Sitemap.
There is a link to the Web Sitemap page
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=183668
I'm looking for examples of how to include Geo location information in the sitemap.xml file.
Would someone please point me to an example so that I can know how to code the reference?
I think the point is that you dont use any specific formatting in the sitemap. You make sure you include all your locally relevent pages in the sitemap as normal. (ie you dont include any geo location in the sitemap)
GoogleBot will use its normal methods for detereriming if the page should be locally targeted.
(I think Google have found the sitemap-protocol has been abused, and or misunderstood, so they dont need it to tell them so much about the page. Rather its just a way to find pages, that it might take a long time to discover though conventual means. )

Writing a htaccess file - RewriteBase?

Right I'll try and explain my situation as thoroughly as possible while also keeping it brief...
I'm just starting out as a web designer/developer, so I bought the unlimited hosting package with 123-reg. I set up a couple of websites, my main domain being designedbyross.co.uk. I have learnt how to map other domains to a folder within this directory. At the minute, one of my domains, scene63.com is mapped to designedbyross.co.uk/blog63 which is working fine for the home page. However when clicking on another link on scene63.com for example page 2, the URL changes to designedbyross.co.uk/blog63/page2...
I have been advised from someone at 123-reg that I need to write a .htaccess file and use the RewriteBase directive (whatever that is?!) I have looked on a few websites to try and help me understand this, including http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html however it all isn't making much sense at the moment.
Finally, scene63.com is a wordpress site, whether that makes any difference to how the htaccess file is structured I'm not sure...
Any help will be REALLY appreciated - Thanks.
I run my personal public website on Webfusion, which is another branded service offering by the same company on the same infrastructure, and my blog contains a bunch of articles (tagged Webfusion) on how to do this. You really need to do some reading and research -- the Apache docs, articles and HowTos like mine -- to help you get started and then come back with specific Qs, plus the supporting info that we need to answer them.
It sounds like you are using a 123 redirector service, or equivalent for scene63.com which hides the redirection in an iframe. The issue here is that if the links on your site use site-relative links then because the URI has been redirected to http://designedbyross.co.uk/blog6/... then any new pages will be homed in designedbyross.co.uk. (I had the same problem with my wife's business site which mapped the same way to one of my subdirectories).
What you need to do is to configure the blog so that its site base is http://scene63.com/ and to force explicit site-based links so that any hrefs in the pages are of the form http://scene63.com/page2, etc. How you do this depends on the blog engine, but most support this as an option.
It turned out to be a 123-reg problem at the time not correctly applying changes to the DNS.

can htaccess prevent a file type being written to a directory?

Is it possible to get the htaccess to only allow certain files to be uploaded to a directory?
I have found several posts discussing how to get htaccess to only allow images out, disable php, output scripts in plain text form... but I cannot find if it is or is not possible to get htaccess to prevent files of a certain type from even entering the directory in the first place..
Could anyone possibly help me out on this query?
No, this is not possible. Apache is a web server, it can generally not control what gets written by a PHP or other script into a directory.
You will need to manage this in the script that you use to upload files.

Need ideas on how to protect .exe file from direct download on other sites

We have our application stored on our server, it is an .exe file. The download page is only accessible from our site - using cookie authentication in PHP. I know there are better methods but there is a long story behind this...so I'm moving on. The issue is that the actual url of the .exe has been leaked and is appearing on other websites. What is the best method to protect a link to a file, not the page itself. That is where I'm having issues. I can make it difficult to get to the download page (with the link) but don't know where to begin to make sure the link is only accessible from our site... Is .htaccess (preventing hotlinking) the best way to go?
Yes, .htaccess is probably best. Find any online post about protecting images from hotlinking, the first in my google search looks like a nice and easy auto-generator you can use. Just change the image extensions to exe, or keep them if you want them protected too.

Serving a text link to a hotlinked image?

I am trying to create some sort of hotlink protection system. I want to use my hotlinked images as an advertising means. Initially i thought printing the URI of the specific image on it, but because the length of this varies, printing it correctly appears to need too much effort. I am now looking into the possibility of printing the image and below it a text link, or just the text link.
I think i had seen this before, but i'm not sure how to do it. I searched around but couldn't find any help. Can someone help me out or point to a tutorial or something, to display text on hotlinked images?
Thanks!
You may be better off creating a watermark on the image if you want to protect your images. The problem though with watermarks is that they detract from the view's experience, especially when they are obtrusive.
If you want to intercept requests to your website directly to your image you can add hotlink protection.
If your host has cPanel here is a tutorial on how to setup Hotlink Protection on your website using cPanel.
But it sounds like you want to 'roll your own' with custom text over your hotlinked image. To do that you'll need to intercept the image requests. How you do that will depend on if your host is Windows or Linux based. With Linux based you can use your .htaccess file to redirect image requests to a script of your choosing. In Windows, I'm not sure how to do it (perhaps someone else can elaborate?).
Here is a tutorial on using htaccess to stop hotlinking.
In the above tutorial it shows you how to redirect requests to your images to a static link, but in your case you can redirect them to a script or a different hidden directory (e.g. /image.jpg would return /hotlinked/imageWithText.jpg), that would have text overlay.
If you need the text to by dynamic then you can redirect the request to your favorite web server script like Perl, PHP, etc. that will then load the image and add the text overlay.
Take care.

Resources