Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP 301 redirect location URI format

Is this a correct URI for the header('Location: '), specifically ./?

header ('HTTP/1.1 301 Moved Permanently');
header ('Location: ./');

Thank you.

like image 972
Francisc Avatar asked Apr 21 '11 09:04

Francisc


People also ask

How can I redirect a URL to another URL in PHP?

Answer: Use the PHP header() Function You can simply use the PHP header() function to redirect a user to a different page. The PHP code in the following example will redirect the user from the page in which it is placed to the URL http://www.example.com/another-page.php . You can also specify relative URLs.


1 Answers

You can also use:

header('Location: /', false, 301);

I assume you want to redirect to the 'homepage', that'd be / instead of ./

like image 167
Wesley van Opdorp Avatar answered Nov 24 '22 00:11

Wesley van Opdorp