Php/Javascript Redirect To Another Page or Url

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/phpjavascript-redirect-another-page-url/
PINTEREST
PINTEREST
INSTAGRAM

PHP is popular programming or scripting language used to develop web pages. One of the problem developers face is using PHP to redirect user browser to the new page. for example we have an old URL but we want to make transition to the new url we can achieve this simply by using  PHP redirect.

Simply Redirect

We will use header function of PHP to provide new URL to the client browser. Keep in mind that after using header function there should be no other operation that will output something or simple be sure header is last function.

Alternatively Use JavaScript

JavaScript is mainly client side scripting language. Redirect operation can be done with JavaScript on the client side by providing new URL to the windows objects location property like below.

Even we can make a Javascript function to use it multiple times easily

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/phpjavascript-redirect-another-page-url/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)