I am wanting to write a quick and simple program that will capture URLs submitted by the user and look in a simple textfile to see if it should be redirected.
Basically setting up an April Fools joke for NFL Draft Day.
Want to redirect the following sites
www.dallascowboys.com -> www.HoustonTexans.com
.
figure it would be best to enter the from and to into a simple text file so anyone can use it for any type of gag. Do not want to effect any other websites (i.e. yahoo. msn, espn, etc).
Format would be something like
siterequested, redirectedsite
i.e
www.dallascowboys.com, www.houstontexans.com
Basic program code is not the problem. THE PROBLEM:Trying to figure out a method to intercept from IE, Firefox, Mozilla, etc the URL requested and replace it/redirect it.
Thanks for any help,
Slyvnr
Quick URL Redirector
Re: Quick URL Redirector
What about changing the hosts file?
(C:\WINDOWS\system32\drivers\etc\hosts on windows and /etc/hosts on linux IIRC)
(C:\WINDOWS\system32\drivers\etc\hosts on windows and /etc/hosts on linux IIRC)
Good programmers don't comment their code. It was hard to write, should be hard to read.
-
SeregaZ
- Enthusiast

- Posts: 629
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Quick URL Redirector
any idea how to make this redirector without editing this host file?
for example if i starting some atomic web server, and in this host file will be some redirect, like google.com to 127.0.0.1 - after shutdown this server google.com It is inaccessible. so it must be some procedure in program - that can return host file to normal, without redirecting.
and some antiviruses blocking editing host file.
for example if i starting some atomic web server, and in this host file will be some redirect, like google.com to 127.0.0.1 - after shutdown this server google.com It is inaccessible. so it must be some procedure in program - that can return host file to normal, without redirecting.
and some antiviruses blocking editing host file.
Re: Quick URL Redirector
Instead of getting what the webpage address is, what about simply looking for a window with the title "Dallas Cowboys - Home - Windows Internet Explorer" (or just with the first letters as "Dallas Cowboys") and then if that window exists either do one of two things:
1. This would be the easiest to code, close the window and open a new browser window with the new url.
2. Redirect the browser page. Possibly edit the text of the url field and then simulate a press on the Go button? Not sure. Is it possible to just access the actual browser element/gadget on the page and change the url that is being displayed?
1. This would be the easiest to code, close the window and open a new browser window with the new url.
2. Redirect the browser page. Possibly edit the text of the url field and then simulate a press on the Go button? Not sure. Is it possible to just access the actual browser element/gadget on the page and change the url that is being displayed?
-
SeregaZ
- Enthusiast

- Posts: 629
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: Quick URL Redirector
if i try to redirect some java sript from another server? whole page is normal, but a few java script is bad. this redirect with host file swithcing this bad java for normal java script and whole page in browser will be without mistakes.
in this host file information about switching servers is open - anyone can to know what replace and where replase. how to make hide this redirect? that is why i want to know any ahother metod of redirection - very close to redirect in host file, but more hidden.
in this host file information about switching servers is open - anyone can to know what replace and where replase. how to make hide this redirect? that is why i want to know any ahother metod of redirection - very close to redirect in host file, but more hidden.


