Jump to content

Recommended Posts

I have a login page which remembers what you were trying to access, then uses header('Location: url here') to redirect the user back to what they were trying to access after a successful password.

 

However, the URL remains my.domain.here/login.php, instead of where they were redirected to... which breaks my relative links if they are redirected to a page within a subdirectory.

 

Any ideas?

 

Thanks,

Erik

Link to comment
https://forums.phpfreaks.com/topic/65639-redirecting-and-changing-the-url/
Share on other sites

One thing to check...

 

After a successful login, go to File -> Properties and check the URL for the page.

Sometimes the browser, for whatever reason, does not update the address bar after a page change though you're actually at a new page.

Yeah, that's my issue.  The browser (both Firefox 2 and IE 7) doesn't update the address bar, and then uses  that old address to calculate the relative links... so everything breaks.

 

Since both browsers did it, I assumed there is something I can do in PHP.

Whoops... Just re-read your first post.

You'll need php, not HTML for the redir page.

 

When they login, send a location header like this: redir.php?http://redirect.to.here.com

Then redir.php will do the meta-tag refresh to take them to the URL in the query string.

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.