A script to redirect based on the subdomain (like: [login to view URL] vs. [login to view URL])
$30-40 USD
Pagado a la entrega
I found a perl script years ago that I installed on my shared hosting webserver as [url removed, login to view] and did what I needed: if you type [url removed, login to view] in your web browser, the page would redirect to 1 page, vs. [url removed, login to view] would go to another page. I had dozens of these redirects I used as shortcuts to different apps, utilities, etc.
For some reason with my hostgator account, it stopped working. I need you to either get this working or give me another script that does the same thing that I can add as many redirects as I want.
## Deliverables
Here's the basics of the script. This assumes my domain is [url removed, login to view], which it is not:
(I added the line numbers manually in the question. They are NOT in the script:
1) #!/usr/local/bin/perl
2) $mainpage = "[url removed, login to view]";
3) %domains = (
4) '[url removed, login to view]' => '[url removed, login to view]',
5) '[url removed, login to view]' => '[url removed, login to view]',
6) '[url removed, login to view]' => '[url removed, login to view]'
7) );
8) $server = lc($ENV{'HTTP_HOST'});if ($ENV{'HTTP_HOST'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+<wbr />)/){$t='/'<wbr />}else{if ($server !~ /^www./){$server = '' . $server;}}@domains = keys(%domains);foreach $domain(@domains){if ($domain eq $server){print "Location: $domains{$server}\n\n";$ma<wbr />tch="yes";<wbr />last;exit}<wbr />}unless($m<wbr />atch){prin<wbr />t "Location: [url removed, login to view]\n\n";exit<wbr />}exit;
Normally, there would be loads of those line 4 and 5. The last of them - line 6 in this case - needs to NOT have the comma at the end. I AM NOT a developer / coder : ) I just figured these things out over time.
Hostgator had me install an SSH client and this is the error I get when I run it:
and the errors I get even with this very short list of redirects:
a@[url removed, login to view] [~/public_html]# perl -w [url removed, login to view]
Name "main::t" used only once: possible typo at [url removed, login to view] line 8.
Name "main::mainpage" used only once: possible typo at [url removed, login to view] line 2.
Use of uninitialized value in pattern match (m//) at [url removed, login to view] line 8.
Location: [url removed, login to view]
I don't know if these are non-critical errors? I never did this when it was working OK
Nº del proyecto: #2788577