IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

How To Protect Css File From Public?


itssami
no avatar
Super Member
*********
Group: Members
Posts: 258
Joined: 13-November 05
Member No.: 14,234



Post #1 post Apr 29 2006, 11:46 AM
i want to include a css file in a webpage , but i want to to keep it somewhere where people can not access it.
for example ,if i keep a css file in, domain.com/somefolder/cssfile.css , then anyone can access it.. because in page dource there is that css file url.. i want that even when someone save the page , he can not have access to my css file.. is it possible ?? thanks
Go to the top of the page
+Quote Post
Inspiron
no avatar
Trap Grand Marshal Member
***********
Group: Members
Posts: 1,203
Joined: 25-March 05
Member No.: 4,883



Post #2 post Apr 29 2006, 11:56 AM
You cannot keep it somewhere where people cannot access the stylesheet. The html file you've coded have linked to the stylesheet. Hence whenever your visitor visits your site, the stylesheet is also downloaded together with the html file, images, sounds etc. The alternative to protect your stylesheet is to encrypt it in such a way only your html is able to understand. Humans, like us, will not be able to understand the stylesheet codings even if they've got the exact stylesheet file.

A little search on google gave a nice software that is able to encrypt your stylesheets as well as your html files and javascripts.
http://www.htmlguardian.org/help_main.html

As stated on the webpage,
QUOTE

nearly 90% of the webmasters who want to encrypt html code, protect ASP, Javscript, VBScript, PHP files or style sheets, hide html source from thieves, need extremely secure html password protection or an enhanced image protection use HTML Guardian.


Fortunately there's a fully functional free Personal Edition for download and use. You may like to try that out.
Go to the top of the page
+Quote Post
farsiscript
no avatar
Super Member
*********
Group: Members
Posts: 357
Joined: 8-April 06
Member No.: 21,487



Post #3 post May 2 2006, 07:20 PM
You can use HotLink Protection for your style and css files
i use HotLink Protection for my images in my site
you can find HotLink Protection in cpanel
HotLink Protection is in Cpanel , at first login in cpanel and click at Leech Protect , then type your style or css or image url . smile.gif thants all
look at note of HotLink Protection ::

QUOTE
HotLink protection prevents other websites from directly linking to files (as specified below) on your website. Other sites will still be able to link to any file type that you don't specify below (ie. html files). An example of hotlinking would be using a <img> tag to display an image from your site from somewhere else on the net. The end result is that the other site is stealing your bandwidth. You should ensure that all sites that you wish to allow direct links from are in the list below. This system attempts add all sites it knows you own to the list, however you may need to add others.


This post has been edited by farsiscript: May 2 2006, 07:21 PM
Go to the top of the page
+Quote Post
jlhaslip
no avatar
Insert Custom Title Here
*******************
Group: [MODERATOR]
Posts: 4,908
Joined: 24-July 05
From: Linux, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol
myCENT:6.20



Post #4 post May 2 2006, 09:34 PM
Hotlink protection will only stop others from accessing the file from another server or another Domain.
The way Hotlinking works is to stop others from using the file from your account on your server to style their page on their site. Or from using your Bandwidth to display an image from your account on their page.
As Inspiron pointed out, the css file must be accessible to be sent along with the html, so Hotlink protection will not be good in this instance. And I believe that if you move the css file above the public_html folder, it would not be served with the pages, either, leaving the encryption method as the correct alternative.
On the other hand, what's the big deal about letting others see you css? Are there State secrets stored in there? Matters of National Security? Letting people see the css file is not a big deal.
Go to the top of the page
+Quote Post
WindAndWater
no avatar
Advanced Member
*******
Group: Members
Posts: 106
Joined: 1-April 06
Member No.: 21,148
myCENT:ZERO



Post #5 post May 2 2006, 10:06 PM
Since hotlinking is already mentioned the manual (and slightly cleaner) way to do it is to add the following to your .htaccess file:
CODE
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.css$ - [NC,F,L]

If someone tries to navigate directly to your .css file it'll send them to the 403 forbidden page instead.
However, there are two problems with this approach. 1) It's very easy to fake the referer, and so it's quite easy to circumvent. 2) The .css files are downloaded to and interpreted on the user's local computer like .html files. That means that each and every person who looks at your html page will have your css page on their computer, at least for a little. However, both of these workarounds probably won't occur to the average user, so you can still block most people from seeing it.
Go to the top of the page
+Quote Post
Tyssen
no avatar
***********
Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



Post #6 post May 3 2006, 01:52 AM
Why do you want to hide your CSS anyway? It's highly unlikely you're going to be doing anything that no-one else has done before.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts 5 Vacant 5,644 3rd December 2008 - 02:43 AM
Last post by: wingman23
No New Posts   8 -Pandemonium- 9,297 25th August 2004 - 04:00 PM
Last post by: -Pandemonium-
No New Posts 5 BoSZ 10,306 8th January 2009 - 07:35 PM
Last post by: Arthur Dent
No New Posts 6 dozen 4,653 9th September 2004 - 11:58 PM
Last post by: Triple X
No New Posts   4 annylei 4,651 14th September 2004 - 09:38 PM
Last post by: Triple X
No New Posts 10 jailbox 4,907 19th August 2009 - 07:17 PM
Last post by: iworld200
No New Posts   3 josh_sg1 4,240 12th October 2004 - 12:02 AM
Last post by: s2city
No New Posts   8 sohahm 5,139 21st October 2004 - 08:44 PM
Last post by: beg4mercy
No New Posts   0 sohahm 3,558 16th October 2004 - 01:46 AM
Last post by: sohahm
No New Posts   13 Lyon 13,656 9th February 2009 - 10:42 AM
Last post by: aloKNsh
No new   14 Lyon 7,549 1st November 2004 - 07:43 PM
Last post by: -3ad3oy-
No New Posts   1 Ungreezor 730 25th July 2009 - 04:48 PM
Last post by: chrismiller3404
No New Posts 9 Paul 980 11th June 2006 - 01:47 PM
Last post by: adriantc
No New Posts   1 liliano 3,349 29th October 2004 - 07:30 PM
Last post by: BoSZ
No New Posts   9 MuTeD 6,784 13th November 2004 - 12:22 PM
Last post by: no9t9


 



RSS Open Discussion Time is now: 8th November 2009 - 08:11 AM

Web Hosting Powered by ComputingHost.com.