PHP Redirect


Hi there.
I’d like to have a PHP code that can redirect a user to a webpage specified in a form. So basically, then type a URL, hit submit, and it then redirects them to the specified URL.
How can this be done?



I don’t know why you would do that outside of a test app, but you could handle it on the processing page, or more easily, use javascript to add that url to the action attribute on the form.


It does make sense in the application I have for it. Basically I have a form with a basic text entry field that I would like people to type a URL into, and once they hit submit, it brings them to the entered URL.
Could you supply some code or information on how this is possible?



you mean like… ehm… an adress-bar? within a… browser or something?

1 Like

Alright I got it working somehow.
Basically, take a look here:
My staff can enter their username and if it is a vaild username, it will ask them for their username and password again to log them in (using .htaccess auth)

Basically when they enter their username, it tries to visit:
If it is an actual file on that subdomain, it redirects them to:
and their browser will ask them for their username and password (auth is via .htaccess)
If it isn’t an actual fine on that subdomain, it sends them to the 404 page on that subdomain which then redirects them to a username not found message on