0

I want everytime people go to my website, it will automatically redirect to another website, say:

https://www.redirect.com/link?q=NEWSTRING

it sounds weird, but actually, what I want is when people load my page, it will trigger some scripts, in which it can tract "NEWSTRING" from some website, then put it to the link above to redirect my website there. So what I have is a first part of the link, which is fixed:

https://www.redirect.com/link?q=

then

NEWSTRING 

is obtained from my script, now how to write some thing that will redirect the webpage? What I can think of is, write something in python.py, then rename it to .cgi, then upload it to my server at :

/home/xxxxx/public_html/cgi-bin/python.cgi

Will this make my website automatically load and redirect there ? Thanks a lot !

1
  • We need information on which webserver you are using; does it even support python? Commented May 30, 2013 at 6:58

2 Answers 2

1

Why not just use straight HTML to redirect to the website you want? I might not understand your question correctly, but for example

<meta http-equiv="refresh" content="0; url=http://example.com/">

would redirect the user to http://example.com when loading your page.

Sign up to request clarification or add additional context in comments.

1 Comment

can I put python script together with it ? Coz I need to extract some info from another web to put it to this link. Like this :stackoverflow.com/questions/16829066/…; can it be done easier by html and javascript ?
0

What you need is an AJAX request.

When people load your web page, the page sends an AJAX request to some other site, and render your page after getting the request result.

6 Comments

can we use that in middle of python code ? Coz I get the NEWSTRING using python
the AJAX request is sent in javascript via GET/POST method to a server, in your case, where your Python script runs. So write a handler for this AJAX request which returns data to the javascript.
are they coded in the same file (like inded.html) or what kind of link between them ? Can you give an example pls !
Have you successfully run your python script on some server?
It is the first time I think of using it on the server. But I think people must use it very often outthere
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.