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

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
  3. #
  4. #            Domain Name            Redirect To URL
  5. #
  7. $Default_URL = "";
  9. %Domains = (
  11.     "" => "",
  12.         "" => "",
  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";
Apr 15 '10 #1
Share this Question
Share on Google+
1 Reply

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;
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.


Apr 16 '10 #2

Post your reply

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