By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,712 Members | 1,958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,712 IT Pros & Developers. It's quick & easy.

redirect script BGCOLOR

P: 1
Hi,

I was wondering if it possible to change the background color of the redirect script below to black so that there isn't a flash of white during the redirect?

The script works fine other than the color.

I'm new to perl and tried adding a print string in a number of ways, but nothing works. Any advice would be greatly appreciated.


Thanks in advance for your time.



Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. #
  4. #            Domain Name            Redirect To URL
  5. #
  6.  
  7. $Default_URL = "http://www.TestDomain.com/main.html";
  8.  
  9. %Domains = (
  10.  
  11.     "abc123.com" => "http://www.abc123.com/index.html",
  12.         "www.abc123.com" => "http://www.abc123.com/index.html",
  13.  
  14.  
  15. foreach $line (keys(%Domains)) {
  16.         if ($ENV{'HTTP_HOST'} =~ /$line/i) {
  17.         print "Location: $Domains{$line}\n\n";
  18.         exit;
  19.         }
  20. }
  21. print "Location: $Default_URL\n\n";
  22.  
Apr 15 '10 #1
Share this Question
Share on Google+
1 Reply


numberwhun
Expert Mod 2.5K+
P: 3,503
First, regarding your code, you need to use code tags around your code. I have added them this time, but please learn to use them.

Also, in your scripts, you want to be sure to include the following pragmas:

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
  3.  
They will cut down on most of the common errors that you will make, or at least point them out to you when you run your code.

As for the hash you created, You did not complete the structure in the code you posted, so you are going to get an error when this runs.

Now, as for your question, I doubt you will achieve what you expect. There will always be a millisecond flash. See this thread for an explanation.

Regards,

Jeff
Apr 16 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.