Web Development



How can I protect the contents of my website?

By padam123 ·
I am developing a dynamic website as a part of my study.

I have organized the contents in different folders such images, photos etc. But when i type the full path of the image or any other file in the address bar it opens.

But I don't want so specially for images. But those images should appear in the web pages.

Is there some technique to prevent the images to display?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

If I understand your question correctly

by OH Smeg Moderator In reply to How can I protect the con ...

Then there is no way to prevent the Image opening if you type in the Full Address of it in a Web Browser.

The thing here is that others viewing the Web Page will never see the Sub Folders of Files & Images or anything else that you hide in that Web Site so they will not know that it is there and if you don't post directions to reach these files/folders they will not be able to access them directly.

By typing in the full address of a File/of any type the Web Browser takes you to that address.

However there are other ways of setting up Web Hosting Services and making certain parts of the Entire Web Site Private. That however is down to the Hosting Software not the Web Page itself.

I'm no expert in Web Design though and maybe some others here at TR who specialize in this work can give you pointers in other way of doing things.


Collapse -

No simple solution

by nvrtis In reply to How can I protect the con ...

A web server cannot tell the difference between a request for a file from a link (img or href) and a request typed into the address bar of the browser.

You can protect the whole site or individual directories (look up htaccess) with a password. But then all site visitors will need to enter the password.


Collapse -

make a .htaccess file

by Slayer_ In reply to How can I protect the con ...

You might need to use DOS to make this file as Windows won't let you make a file starting with a .

Click Start
Type cmd
in the command prompt, type

edit C.htaccess

This should open up a blue editor. Enter this text.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?YourWebsiteAddress.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://YourWebsiteAddress.com/Images/StopStealing.jpe [R,NC]

Since that is hard to read, I also put it in a txt file for you.


This may work, I am not certain

Collapse -

Thank you

by padam123 In reply to make a .htaccess file

Thank you all for your useful answers.

It's been a great pleasure to have experts out there.

I will be asking a lot of questions in this forum as i am pretty much interested in PHP and MySQL

Thank you ala again

Collapse -

Your Welcome EOM

by OH Smeg Moderator In reply to Thank you

Related Discussions

Related Forums