0

I am trying to access a PHP file that is located in another folder.

$path =  $_SERVER['DOCUMENT_ROOT'];
echo $path;

It's displaying: /Applications/MAMP/htdocs/mysqli

I am trying to redirect to welcome_employer.php in the folder "... mysqli/employers". How can I do this?

header('Location:'.$path.'/employers/welcome_employer.php');

Thanks

2 Answers2

1

See: How to make a redirect in PHP?

In particular, the

header('Location:'.$path.'/employers/welcome_employer.php');

Request will be interpreted, ultimately, by the browser. So rather then $path you need the site's base URL there.

Community
  • 1
  • 1
Donald_W
  • 1,773
  • 21
  • 35
0

I think you need to use path like

http://localhost/test/test.php

you can't use $_SERVER['DOCUMENT_ROOT'];

use $_SERVER['host']; and then give your directory path

Kruti Aparnathi
  • 175
  • 1
  • 11