Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ^(.*)$ http://www.mymainwebsie.com  [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 http://www.mymainwebsie.com.

the problem is using the above rules I am able to prevent the file www.example.com/info/card/index.jsp 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 http://www.mymainwebsie.com 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 example.com/info/card/index.jsp which has 'card' in the url. I donot want this to be redirected to 'mymainwebsie.com.'; I am able to achive this using the posted code. but internal requests like requests for images,css,js etc are getting redirected to 'mymainwebsie.com.'; 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 example.com/css/style.css,http://www.example.com/images/… –  Sweekar Sharma Apr 5 '12 at 1:44

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.