How do I block access to my CSS?

Discussions about Apache mod Rewrite, .htaccess, Use, experiences ... URL Rewriting.

Moderator: Moderators


How do I block access to my CSS?

Postby Brandon » Sun Jan 28, 2007 12:45 am

Hey,

I have been trying to block access to my CSS, JS and PHP include(s) files. I have been able to block the PHP files with this code:

Code: Select all
<Files *.php>
order allow,deny
deny from all
</Files>


And the PHP includes still work. I have tried doing the same thing for my CSS, but then no CSS styles are included on the page... Is there anyway to block direct access to my CSS/JS files so that they can't be downloaded, and still keep the pages working?

Thanks, Brandon
Brandon
 
Posts: 8
Joined: Tue Jan 09, 2007 7:39 pm

Advertisement

Postby dcz » Sun Jan 28, 2007 2:14 am

Well the problem is, css style sheet, as well as html, must be publicly reachable to be loaded by a browser.

Includes are server-side, so you do not need to leave the access to all php files.

That's just how it is ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 19930
Joined: Fri Apr 28, 2006 9:03 pm

Postby Brandon » Sun Jan 28, 2007 2:17 am

Sigh... Okay. What about javascript and images, is there anyway to block those?
Brandon
 
Posts: 8
Joined: Tue Jan 09, 2007 7:39 pm

Postby dcz » Sun Jan 28, 2007 12:39 pm

The same.

You can implement some JS to hide JS a bit, and html as well, but, it's not really a protection, since user would see everything all right if they turn JS off.

Anyway, what are you afraid about ?

Internet is mostly public, everybody can access most of the source code, and that's probably why it's growing so fast, because sharing is almost mandatory ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 19930
Joined: Fri Apr 28, 2006 9:03 pm

Postby Brandon » Tue Jan 30, 2007 7:03 pm

I guess I will just leave it public...

At it's not that I'm "afraid" of anything, I just like ot keep my sites locked down as tight as possible - For security reasons.

Thanks!
Brandon
 
Posts: 8
Joined: Tue Jan 09, 2007 7:39 pm

Postby dcz » Tue Jan 30, 2007 7:56 pm

You do not take great security risks with css style sheets IMHO, but it's better to think about security like you seem to do.

Locking all php files called through include is for sure a wise thing.
You may as well want to do as phpBB does in addition, define a IN_PHPBB constant in the public files, and check if it was declared in the included ones :
Code: Select all
if ( !defined('IN_PHPBB')  )
{
   die('Hacking attempt');
   exit;
}


I think it's even better to rely on both php, with this check, and Apache, with the .htaccess, to deny access to these files.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 19930
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Wed Jan 31, 2007 6:12 am

Hello, good question. I found this...

Code: Select all
<Files ~ "\.tpl$">
Order allow,deny
Deny from all
Satisfy All
</Files>


Credit
CyberAlien
User avatar
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 520
Joined: Wed May 10, 2006 9:46 am
Location: Michigan


Return to Apache mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests


 
cron