Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider this code:

RewriteEngine On
RewriteRule ^$  http://%{HTTP_HOST}:8177/index.jsp [C]
RewriteRule ^http://([^:]+):([^/]+)(.*) http://$1:8177$3 [R=301]
RewriteRule ^/$ http://%{HTTP_HOST}:8177/index.jsp [C]
RewriteRule ^http://([^:]+):([^/]+)(.*) http://$1:8177$3 [R=301]

RewriteCond %{REQUEST_URI} card.* 
RewriteRule ^ - [L]

RewriteCond %{REQUEST_URI} Voucher.* 
RewriteRule ^ - [L]

RewriteRule ^(.*)$  [R,L]

The server configuration on the website is split in 2 parts. 1 having static content an the other having dynamic content. static content is stored in apache server (ver 2.2) and dynamic content is stored in weblogic server (10.3). Every request is handled by the webserver (apache). Internally it decides on the basis of the folder name, whether the request has to be served by the apache server or weblogic.

Problem:- I have the requirement where few files present in the above directory are not required to be redirected, rest all files are to be redirected to

the problem is using the above rules I am able to prevent the file from getting redirected. but... all internal requests like request for images, javscript, css are not getting prevented from rediection. All these internal requests are getting redirected to which should not happen.

what I need is once any url matching the above pattern is received there should not be any redirects.

note:- the rewrite rules are written in a .conf file and not in .htaccess file.

share|improve this question
any url matching the above pattern - which pattern do you mean? Can you clarify what behavior you're looking to achieve overall? – Shane Madden Apr 5 '12 at 1:29
@ShaneMadden : I guess he means card.* and Voucher.* – kishu27 Apr 5 '12 at 1:33
lets say I have a url which has 'card' in the url. I donot want this to be redirected to ''; I am able to achive this using the posted code. but internal requests like requests for images,css,js etc are getting redirected to ''; so the page doesnot contain any images, css, js. – Sweekar Sharma Apr 5 '12 at 1:33
Ok - what are the URLs being requested for the images, CSS, and js code? – Shane Madden Apr 5 '12 at 1:39
@ShaneMadden : its like,… – Sweekar Sharma Apr 5 '12 at 1:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.