Sign in to follow this  
Followers 0
Ram

Redirect URL to specific url on my computer

6 posts in this topic

Hi,

I am looking for a way to do the following:

For example:

I open a browser (say Fire Fox, IE or Chrome) in the address bar I type www.google.com and press enter automatically the url should be redirected to plus.google.com

Is this possible?

I am trying to do this using HOST file on my computer but the problem is that HOST files accept only IP address so the subdomain url don't have the actual iP address hence I can't do it with HOST file.

Can the above scenario be achieved using autoitscript? if so how do I go about doing this?

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

My brother's response:

Yes, it can be done with AutoIt. However! The following requirements must be met:

1. Language requirements - eg. This can ONLY be run on windows. Trust me. I tried running this on WINE under Ubuntu. Didn't work.

2. CGI-capable server. XAMPP is fine for this HOWEVER the folder this file is put in MUST be able to execute CGI scripts. In XAMPP, this is XAMPP_dir/cgi-bin/ by default.

We are going to output some HTTP1.1 headers. You don't need to understand much, other than it must be the first to come out before the HTML, and even more importantly, it must go out through 'Standard Output'. And guess what - AutoIt supports standard output - tested and verified by me. However it may seem a bit strange for web-based applications. Enough of me babbling.

Put the following in a file and compile it as plus.exe

ConsoleWrite("Location: plus.google.com")                  ; Will redirect to google plus

That's it!

Just compile it as a .exe THEN rename it to .cgi.

Then put it in your cgi-bin and navigate to the file in your web browser. If this has been done correctly, you will have a redirect to google plus! Good job - I knew you could do it!

Edited by Mikeman27294

Share this post


Link to post
Share on other sites

My brother's response:

Yes, it can be done with AutoIt. However! The following requirements must be met:

1. Language requirements - eg. This can ONLY be run on windows. Trust me. I tried running this on WINE under Ubuntu. Didn't work.

2. CGI-capable server. XAMPP is fine for this HOWEVER the folder this file is put in MUST be able to execute CGI scripts. In XAMPP, this is XAMPP_dir/cgi-bin/ by default.

We are going to output some HTTP1.1 headers. You don't need to understand much, other than it must be the first to come out before the HTML, and even more importantly, it must go out through 'Standard Output'. And guess what - AutoIt supports standard output - tested and verified by me. However it may seem a bit strange for web-based applications. Enough of me babbling.

Put the following in a file and compile it as plus.exe

ConsoleWrite("Location: plus.google.com")                  ; Will redirect to google plus

That's it!

Just compile it as a .exe THEN rename it to .cgi.

Then put it in your cgi-bin and navigate to the file in your web browser. If this has been done correctly, you will have a redirect to google plus! Good job - I knew you could do it!

what do you mean by saying "navigate to the file in your web browser" - does it mean I doing something manually if so the idea is that.. when ever i enter google.comon my address bar - it should automatically redirect me to plus.google.com.

Share this post


Link to post
Share on other sites

What he meant by that, is you type into your address bar:

localhostCGIBinFilename.cgi

If you have a domain name, you should be able to replace localhost with the domain name.

Share this post


Link to post
Share on other sites

in the address bar I type www.google.com and press enter automatically the url should be redirected to plus.google.com

Is this possible?

To redirect a domain you own/control is very simple. For a domain you do not control, you need to control the network, and know what you are doing.

To redirect the www.google.com url, you will need to have control over your DNS, either by proxy server or by your own DNS server.

Share this post


Link to post
Share on other sites

It can probably be done with AutoIt, but that would be about the most retarded way to do it.

If you are using Firefox, install Greasemonkey and then install a custom redirection script. It only takes a few lines of javascript to do this.

var loc = String(location);
if (loc.match(/www.google.com/i))
{
    loc = loc.replace("www", "plus");
    window.location = loc;
}
Thanks for the help installing plugins and working on it ...is lot of work. I guess this time AutoIT can't me help with this... :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0