Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Translation: ASP.NET Server.Transfer in PHP

Tags:

php

asp.net

How would I do this in PHP?

Server.Transfer("/index.aspx")

(add ';' for C#)

EDIT:

It is important to have the URL remain the same as before; you know, for Google. In my situation, we have a bunch of .html files that we want to transfer and it is important to the client that the address bar doesn't change.

like image 246
jrcs3 Avatar asked Nov 17 '25 13:11

jrcs3


2 Answers

As far as I know PHP doesn't have a real transfer ability, but you could get the exact same effect by using include() or require() like so:

require_once("/index.aspx");
like image 98
TravisO Avatar answered Nov 19 '25 05:11

TravisO


The easiest way is to use a header redirect.

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

Edit: Or you could just include the file and exit if you don't want to use HTTP headers.

like image 37
TJ L Avatar answered Nov 19 '25 05:11

TJ L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!