Forum Moderators: phranque

Message Too Old, No Replies

Apache configure

         

seekstewart

1:09 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



my rewrite rules

# If this global file exists, we're offline.
RewriteCond /v/xyz.com/asg/offline/offline..html -f
RewriteRule .* /v/xyz.com/asg/offline/offline.html [L]

which means as soon as it finds the offline.htm page in /v/xyz.com/asg/offline it throws my outofservice page. (which is offline.html)
so all the trafic coming from www.abc.com gets redirected to offline.html page which says the site is temporarily down.

but i have something like www.xyz.com/cgi-bin/print i want this site to be live....but due to my rewrite rule it throws offline.html page as this url is coming from www.xyz.com

can i write some condition which says www.xyz.com/cgi-bin/print should not be redirected....i guess there should be some condition.....

its kind of looping

in short i don't want to redirect my directory /l/apache/cgi-bin/application

as i write my cgi application which i want throw to customer so that i can collect user information

Rahul

seekstewart

3:23 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



there was a typo www.abc.com should be www.xyz.com

RewriteRule .* /v/xyz.com/asg/offline/offline.html [L]

means everything is redirected to offline.html

can i add some exclude condition , that don't redirect
/l/apache/cgi-bin/ directory to offline.html

just to prevent my looping issue

jdMorgan

4:24 pm on Apr 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Rahul,

Welcome to WebmasterWorld!

Adding two RewriteConds to prevent looping and to prevent rewriting /cgi-bin/print requests, we get:


RewritCond %{REQUEST_URI} !^/offline/offline.html$
RewritCond %{REQUEST_URI} !^/cgi-bin/print
RewriteCond /v/xyz.com/asg/offline/offline\.html -f
RewriteRule .* /v/xyz.com/asg/offline/offline.html [L]

or in a more compact form:

RewritCond %{REQUEST_URI} !^(/offline/offline.html¦/cgi-bin/print)
RewriteCond /v/xyz.com/asg/offline/offline\.html -f
RewriteRule .* /v/xyz.com/asg/offline/offline.html [L]

I would question whether the check for 'file exists' on offline.html is really needed. This invokes an additional filesystem request for each and every request to your server, except for the offline and print pages. It might be a better idea to exclude requests for /robots.txt, /w3c/p3p.xml, and all custom error pages from any rewrites, and simply return a 404 response if offline.html goes missing.

Replace all broken pipe "¦" characters in the code above with solid pipe characters (usually Shift-\) before use. Posting on this forum modifies these characters.

Jim

seekstewart

6:25 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



Hi Jp morgan,

1 issue:

here is the last isseu

in my offline.html i m redirecting it to www.abc.com/cgi-bin/rahul.cgi

rahul.cgi has a button...print "<html> <form action=http://abc.com/cgi-bin/customers.cgi> <input type=submit value=submit></form></input>";

the issue is when i click the button, its looping now and again goes back to www.abc.com/cgi-bin/rahul.cgi

once i get rid of this issue, i m all set.....

seekstewart

6:32 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



this is what i m using:
RewriteCond /v/xyz.com/asg/offline/offline.merchantaccount.html -f
RewriteCond %{REQUEST_URI}!offline.merchantaccount.html
RewriteCond %{REQUEST_URI}!^/cgi-bin
RewriteRule ^.* /v/xyz.com/asg/offline/offline.merchantaccount.html [L]

why do i get looping when i click submit button on rahul.cgi page

seekstewart

7:01 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



hehehe
i found the solution.. i have to add
RewriteCond %{REDIRECT_URL}!^/cgi-bin

seekstewart

7:16 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



one thing is, even after i remove offline.merchantaccount.com file i have to manually delete the cookies and clear the cache from the browser....otherwise it still keeps on redirecting

why?

seekstewart

7:17 pm on Apr 8, 2005 (gmt 0)

10+ Year Member



sorry about the typo in precious message

its offline.merchantaccount.html

seekstewart

7:24 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



this is continuation of [webmasterworld.com...]

as soon as i remove offline.merchantaccount.html file the www.abc.com/cgi-bin/rahul.cgi should be redirected back to www.abc.com

this is because my file rahul.cgi still exists on the server so if someone refresh what they are getting is rahul.cgi page BUT i have already removed html page so if someone refresh page www.abc.com/cgi-bin/rahul.cgi they should get redirected to original www.xyz.com

how do i modify rewrite rule.