Results 1 to 7 of 7
  1. #1
    New Pligger sturko's Avatar
    Joined
    Sep 2009
    Posts
    19

    .htaccess redirect file

    I am trying to protect my style.css file and have found this method:
    http://forum.hostican.com/html-desig...post10421.html

    The first problem i encounter is that redirect from style.css to style.php in pligg .htaccess just dont work:
    RewriteEngine on
    RewriteRule style.css style.php

    Can anybody give me the correct RewriteRule code or can maybe suggest some other way to protect style.css file?

    I have even tryed this method but @import command isnt working in pligg (maybe because it imports php, not css):
    http://forum.hostican.com/html-desig...post10423.html

    Thanks!

  2. #2
    New Pligger darjana's Avatar
    Joined
    May 2010
    Posts
    22
    PHP Code:
    RewriteEngine on
    RewriteCond 
    %{HTTP_REFERER} !^http://domain.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://domain.com$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com$ [NC]
    RewriteRule .*.(jpg|jpeg|gif|bmp|swf|tpl|css)$ http://domain.com [R,NC] 

  3. #3
    New Pligger sturko's Avatar
    Joined
    Sep 2009
    Posts
    19

    still dont work

    Thanks, but i tried this code before,it works if you put it in templates directory, but then even the web page cant access style.css.

    That is because i tried this .css to .php approach i mentoned in this thread.
    If css is going trough php it deny outside access but allow the pligg script to read it.

    Any more suggestions?

    Quote Originally Posted by darjana View Post
    PHP Code:
    RewriteEngine on
    RewriteCond 
    %{HTTP_REFERER} !^http://domain.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://domain.com$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com$ [NC]
    RewriteRule .*.(jpg|jpeg|gif|bmp|swf|tpl|css)$ http://domain.com [R,NC] 

  4. #4
    New Pligger sturko's Avatar
    Joined
    Sep 2009
    Posts
    19

    exact code

    This is quite a common question and would be cool to have some way to protect css.

    Let me maybe write the code from link:

    in pligg.tpl
    first line:
    Code:
    <?php session_start(); $_SESSION['csskey'] = "hello"; ?>
    in style.php
    Code:
    <?php session_start(); header("Content-type: text/css"); 
    if ($_SESSION["csskey"] != "hello") { die("Protected"); } $_SESSION["csskey"] = "somethingelse"; ?> 
    body { background-color: #000; color: #fff; }
    ......

    in .htaccess:
    Code:
    RewriteEngine on
    RewriteRule style.css style.php
    But this dont work in pligg. Why?. maybe path to style.css and style.php is wrong????

  5. #5
    New Pligger darjana's Avatar
    Joined
    May 2010
    Posts
    22
    You should put that code on root directory of your pligg

    I have those code in my htaccess and its working well.

  6. #6
    New Pligger sturko's Avatar
    Joined
    Sep 2009
    Posts
    19
    I have tried that codes, and it doesen't work.

    You have exact same lines of codes?

    Quote Originally Posted by darjana View Post
    You should put that code on root directory of your pligg

    I have those code in my htaccess and its working well.

  7. #7
    New Pligger winsoar's Avatar
    Joined
    Jul 2010
    Posts
    5
    I think I've really messed it up - I set method 2 before copying the text that I should paste over the lines in the .htaccess file.

    Now I can't log in to the admin area because of a 500 server error!

    How can I change the URL method back again so I can log in?

Similar Threads

  1. Permanent redirect coding in .htaccess - canonical URLs
    By realstorm2006 in forum Questions & Comments
    Replies: 12
    Last Post: 11-14-2010, 11:16 PM
  2. htaccess redirect mobile devices to mobile template
    By socialexpert in forum Questions & Comments
    Replies: 0
    Last Post: 02-24-2010, 09:04 AM
  3. .htaccess file is now gone after SEO
    By weebit in forum Questions & Comments
    Replies: 8
    Last Post: 01-17-2010, 09:37 AM
  4. Redirect index.php to root - htaccess
    By israeliporn in forum Questions & Comments
    Replies: 1
    Last Post: 10-29-2009, 10:01 AM
  5. Please help with htaccess redirect Pligg experts
    By justdefend in forum Questions & Comments
    Replies: 0
    Last Post: 02-13-2008, 10:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting