What is the purpose of redirecting index.php to another page in PHP?
Redirecting index.php to another page in PHP can be useful for various reasons, such as improving SEO by consolidating content under a single URL, creating a cleaner URL structure, or simply directing users to a more relevant page. This can be achieved using a header redirect in PHP, which sends a Location header to the browser, instructing it to load a different page.
<?php
header("Location: another-page.php");
exit();
?>
Keywords
Related Questions
- Are there alternative methods, such as creating a gzip archive, to efficiently download multiple files using PHP?
- Are there any potential drawbacks for beginners in using a template engine like Smarty for PHP development?
- How can PHP be used to ensure that edited data from a form is saved back to the database with the same ID?