View Single Post
Old 02-16-2022, 05:02 AM  
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Quote:
Originally Posted by lakerslive View Post
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.
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote