LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-09-2013, 08:48 AM   #1
Mimouch
LQ Newbie
 
Registered: Dec 2013
Posts: 7

Rep: Reputation: Disabled
htaccess rule with a condition


Hi to all,
I want to make an htaccess rule that deny access to any .css or .js files if the requested url doesn't contain the word login.
Thank you.
 
Old 12-09-2013, 11:35 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,596

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Quote:
Originally Posted by Mimouch View Post
Hi to all,
I want to make an htaccess rule that deny access to any .css or .js files if the requested url doesn't contain the word login.
Thank you.
You can try the following:
Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} !(.*)login
RewriteRule (.*\.(css|js)) - [F]
Regards
 
Old 12-17-2013, 09:06 AM   #3
Mimouch
LQ Newbie
 
Registered: Dec 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
check Negative egrep condition in an if condition novicunix Programming 5 02-02-2013 01:52 AM
htaccess rule to change url suj Linux - Server 4 12-09-2012 10:13 AM
htaccess rewrite rule asifbasha Linux - Server 1 09-21-2011 01:48 PM
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 04:33 PM
[SOLVED] Snort - DynamicPlugin: Rule [##] not enabled in configuration, rule will not be used mhollis Linux - Software 3 08-29-2011 07:06 PM


All times are GMT -5. The time now is 10:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration