Perl or bash script to redirect traffic to another site.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This would be great. I know somebody works with these scripts and uses them all the time. My problem is I don’t.
Thank you for reading!
You need to read the "Question Guidelines" link in my posting signature. Yes, there are MANY people who work with Perl and can write scripts. However, if you want one written FOR YOU, then you need to hire someone and pay them to do it. Otherwise, YOU need to show some efforts of your own. We are happy to help, but we aren't going to do your work for you.
Past that, you provide no details; version/distro of Linux, web server you're using, environment, and what your actual goal is. We can't guess.
TBOne - I hired a programmer from Fiverr. You know the site. He couldn’t do it. I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly. Is this just a million CNAMES or is there as I suspect much more to it? I know you Can forward names with Apache. I’ve done that. So that’s two ways CNAMES and Apache. There’s also html.
Please describe your task again, what you want to actually accomplish -- not how but what.
What kind of traffic do you wish to redirect TCP, UDP, etc? Or are you looking above the networking layer at the application layer, HTTPS, SSH, SIP, RTSP, etc?
TBOne - I hired a programmer from Fiverr. You know the site. He couldn’t do it.
Shocked I am not.
Quote:
I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly. Is this just a million CNAMES or is there as I suspect much more to it? I know you Can forward names with Apache. I’ve done that. So that’s two ways CNAMES and Apache. There’s also html.
Again, as asked several times now; WHAT ARE YOU TRYING TO ACCOMPLISH??? You have STILL provided no details about your system, or why exactly you can't do what you need through Apache or html, as you say you already know. Again, you need to do basic research and show your own efforts...putting "perl script url forwarding" into Google pulls up a LOT, including many examples and sample code. Not sure what more you need.
AGAIN: unless you provide details and answer questions, there is nothing we can do to help you.
There are numerous different ways to redirect traffic that vary from a single-line of code/config to installing dedicated switch/firewall appliances with fancy management interfaces.
You almost certainly don't need the latter, but it's not possible to say whether your issue can be solved with a single line because you've still not described what your actual issue is.
* Do you want all traffic from domain1 sent to domain2 or only some of it?
* Does the user need to know they're going to domain2 or does it not matter?
* Are both sites hosted on the same server or different servers?
* What (if any) server software is installed on the machine hosting domain1?
* What level of access/control do you have to that server?
etc
Changing DNS might be an option, but depends on domain2's servers accepting the request for domain1 - a CNAME is just an alias; it doesn't actually redirect - and of course you need control of the DNS records, and there's the propagation delay (can be 20 minutes, can be 48 hours).
Apache has at least four different ways of doing it, depending on the specific needs involved.
A HTML meta refresh is a low skill / low effort solution that may well be perfectly good enough for your needs, but you need to say precisely what those are.
If the website is written in Perl or Bash then they could generate the meta tag, or a HTTP 3xx response, or even act as a reverse proxy - but only if there are conditions involved (e.g. database lookup) that can't be addressed by the front-end server (i.e. Apache), because there's no need to re-write functionality that already exists and is well tested.
Thank you for the Apache site. I use some of this in my site already. The challenge is to create 1000 sub domains that all resolve. This would be like BITLY.com or Facebook. I’m sure these sites are also registrars. I just have to put my toe in the water if you get what I mean?
Thank you for the Apache site. I use some of this in my site already. The challenge is to create 1000 sub domains that all resolve. This would be like BITLY.com or Facebook. I’m sure these sites are also registrars. I just have to put my toe in the water if you get what I mean?
Nope, still don't. And if you're trying to run a large-scale site and you're wanting to do redirects like that, good luck.
Quote:
Originally Posted by Fred27377
If you need to host a site on virtual server. Hit me up no cost and have fun.
If you have no idea how to do a redirect or write a script, why on earth would I want to host a server with you? You've still not answered ANY questions we've asked about your issue, so I'm presuming that communications with you regarding a hosted server would be in a similar vein.
If you're not going to answer questions that are asked of you, why bother posting a question??? You've STILL not provided any details, despite being asked numerous times thus far.
Thank you for caring! How about this. Create a Perl script with a 1000 numbers generated 1 through 1000. Append the host with these numbers in a file. Use Perl cgi to add these to a perlcgi webpage. Generate a 1000 HTML pages with a file label in sequence.
This would work because you could use 1000 of the same page of HTML.
Thank you for caring! How about this. Create a Perl script with a 1000 numbers generated 1 through 1000. Append the host with these numbers in a file. Use Perl cgi to add these to a perlcgi webpage. Generate a 1000 HTML pages with a file label in sequence.
This would work because you could use 1000 of the same page of HTML. Better?
Nope...mainly because you still haven't shown any effort of your own, at all.
AGAIN, we are NOT going to write your scripts for you, period. You have been given direction and hints. You **STILL** do not answer questions asked or provide any details. You have been told this before: https://www.linuxquestions.org/quest...es-4175676771/
I’m looking for url forwarding example. I am not near the Perl scripting phase yet. I want to figure out how some one does it first. Facebook does it and bitly.
I have no idea what you're trying to set up, but if you just want to know how to write something like bit.ly, well, this was my first hit:
This is something the Fiverrr guy should have been able to give you. Unless he was dealing with a common cause of project failure. Which is unclear requirements.
Maybe give us a simplified example where you show us two subdomains and a URL, and tell us how how want the redirection to work?
Alright thank you Dugan. Let’s go again. Maybe the reverse proxy is a better idea. You get a request and generate a blank webpage. You would have to assign page name url and HTML or xml. I liked the GO video. Seemed possible and on demand. I will look for examples. Thank you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.