Php if else not working with main root /
Briefly

To ensure your PHP code responds correctly to the main domain without 'index.php', you can adjust your condition to check for the root URL more flexibly.
Using '$_SERVER['REQUEST_URI']' for debugging helps clarify what the server is receiving, revealing discrepancies and aiding in better condition checks.
Modify your conditional structure to include both 'index.php' and the main root by ensuring the check captures requests accurately for fundamental pages.
For comprehensive control of different URL requests, employ a simple trim or condition that covers cases like '//' which can happen with redirect.
Read at SitePoint Forums | Web Development & Design Community
[
|
]