Jump to content

Recommended Posts

I have been researching this, with varying results.

 

This is just a test at this point

  • User enters data in form > Submits to DB
  • Page refreshes to new, different page

I am using the following in my file:

 

header('Location:/ newPage.php ');

 

When I test this, the page IS redirected, but not to the correct page as coded. It loads a default, company-server advertisement page, stating it could not locate the requested URL/file. This file, newPage.php, lives on the server.

 

Any ideas? Is my syntax incorrect?

 

Thank you in advance.

 

The_Thorn

Link to comment
https://forums.phpfreaks.com/topic/284976-url-redirect/
Share on other sites

You have a space between your slash and your url name.  Specify the url correctly and perhaps it will work.

 

Thank you for pointing those errors out. I appreciate it. I fixed that.

 

But, when running it, I now get This webpage has a redirect loop - I'm not even sure what that means, exactly - I am only redirecting once.

Link to comment
https://forums.phpfreaks.com/topic/284976-url-redirect/#findComment-1463291
Share on other sites

the page you are redirecting to is likely redirecting back to the first page or it's all the same page.

 

this indicates two possible problems -

 

1) you have a logic error. i.e. your program logic shouldn't be redirecting under some conditions and the conditions you are testing are incorrect or don't exist at all.

 

2) you need to have an exit; statement after header() redirects to prevent the rest of the code on the page from running.

Link to comment
https://forums.phpfreaks.com/topic/284976-url-redirect/#findComment-1463296
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.