Quote:
Originally Posted by lakerslive
PROBLEM #1
domain.com/sitemap/ << if you visit this page it still EXISTS
so developer made ANOTHER redirection via .htaccess
domain.com/sitemap/ to domain.com/sitemap.xml
PROBLEM #2
domain.com/sitemap/ KINDA exists... but HOW?
|
If the old url (/sitemap/index.php) is a real path, then yes, you would also still be able to access it directly at /sitemap or /sitemap/index.php.
To prevent this, add something like this at the top of the page at
/sitemap/index.php:
if ($_SERVER[REQUEST_URI] === '/sitemap/index.php' || $_SERVER[REQUEST_URI] === '/sitemap/')
{
header("Location: http://$_SERVER[HTTP_HOST]/sitemap.xml",TRUE,301);
die();
}
It simply checks the current path. If the visited url contains "/sitemap/ " or "sitemap/index.php", force a redirect to yourdomain.com/sitemap.xml.