Jump to content

PHP If url -=


jackr1909

Recommended Posts

Where are you getting a blank page? At http://www.example.com or on the file with the code?

 

Also take the if statement out or comment it out and make an echo statement and see what you get. "I think" it would be something like "/example.com" not http://www.example.com

Link to comment
https://forums.phpfreaks.com/topic/240432-php-if-url/#findComment-1234951
Share on other sites

PHP_SELF will return the page's name, not the full domain name.

(I'm guessing you have several domains pointing to the same place, and you want to send each one to the correct folder?)

try something like:

<?php
$serverName = $_SERVER['SERVER_NAME'];
header("Location:  /".$serverName."/");
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/240432-php-if-url/#findComment-1234988
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.