Hi there.
Here is a sample link to a page i am using as a header.
header("Location: https://www.mysite.co.uk/sample/fire/login.php");
I am using this on a few pages.
If i change the folder name so say change sample to test i then have to go into all the pages and change the folder name to test !
I have tried this code but it does not work.
header("Location: <? BASE_URL;?>/fire/login.php");
What is the solution ? i want to keep the root just change the folder name ?
Thanks
Maybe the following will help you?
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https://' : 'http://';
$host = $_SERVER['HTTP_HOST'];
// Define your base path here
$base_path = ($host === 'localhost:8888') ? '/clearwebconcepts' : '';
$base_url = $protocol . $host . $base_path;
$adminItems = [
'Create Entry' => $base_url . '/create_cms.php',
'Edit Entry' => $base_url . '/edit_cms.php',
'Add to Portfolio' => $base_url . '/new_portfolio.php',
'Edit Portfolio Page' => $base_url . '/edit_portfolio.php',
'Add Jigsaw' => $base_url . '/add_to_puzzle.php',
'Edit Jigsaw' => $base_url . '/edit_puzzle.php',
'Service Form' => $base_url . '/service_form.php'
];
echo '<div class="admin-navigation">';
foreach ($adminItems as $adminTitle => $adminPath) {
$adminSafeTitle = htmlspecialchars($adminTitle, ENT_QUOTES, 'UTF-8');
echo "<a href=\"{$adminPath}\">{$adminSafeTitle}</a>";
}
echo '</div>';
for your case
define (“BASE_URL”, “https://www.mysite.co.uk/sample/”);
header(“Location:”. BASE_URL .“fire/login.php”);