use php to block traffic to a page

user_password_change.php?user_id=218345&key=08af474ff7e66a3

which shows the users email address
so a people could google their email address and see this page

In robots.txt

User-agent: *
Disallow: user_password_change.php

Even though I have a google webmaster tools account and have verified that I have a correct robots.txt file
 google still has listed the pages for months


so how can I just rename the file to change_my_password.php and use php to block the old page.


Please do not  give me a send an email to google answer. The client is looking for a quick fix.
LVL 1
rgb192Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
did you request through your google webmaster account? I too had same problem on my website and I had requested to remove. It is done.
0
GaryCommented:
For the old page you could just do a 301 redirect to the home page in your htaccess
0
Ray PaseurCommented:
a 301 redirect
That's a good idea.   Here is how I might do it.  Untested code, but probably OK in principle.

<?php 

// SET THE PATH TO THE NEW URL
$my_uri = 'whatever';

// PRESERVE REQUEST ARGUMENTS IF ANY
$my_uri = !empty($_SERVER['QUERY_STRING']) 
        ? $my_uri . '?' . $_SERVER['QUERY_STRING'] 
        : $my_uri
        ;

if (isset($_SERVER["REQUEST_URI"]))
{
    // BAIL OUT WITH 301 AND LOCATION
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $my_uri");
    exit;
}

// IF NO REQUEST URI
header("HTTP/1.0 404 Not Found");
header('Location: /');
exit;

Open in new window

HTH, ~Ray
0
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Dave BaldwinFixer of ProblemsCommented:
Google will continue to list the page, especially if someone else has posted a link to it.  The first thing to do is change the name of the page and the second thing is to change the method to make the user enter their own email address instead of displaying it automatically.
0
rgb192Author Commented:
If user is logged in then all the pages will redirect to a dashboard page
so if the logged in user goes to password page, redirected to dashboard page
I am not sure if it is 300,400
I do not know the exact redirect process but I am sure it is php only (no htaccess)



So if I do user_password_change.php

header("HTTP/1.0 404 Not Found");
exit;


because I do not want to tell the world wide web where the new password file is located

change_my_password.php
0
rgb192Author Commented:
continued:

>>Google will continue to list the page, especially if someone else has posted a link to it.  The first thing to do is change the name of the page and the second thing is to change the method to make the user enter their own email address instead of displaying it automatically


or is it better to delete the old page
0
Dave BaldwinFixer of ProblemsCommented:
Changing the name is effectively deleting it because it will no longer be found.  Changing the method to require that the users enter their own email addresses means that the email addresses will no longer be found even if Google does find the new page.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
One last comment, and then I'll sign off on this question.
user_password_change.php?user_id=218345&key=08af474ff7e66a3

which shows the users email address
so a people could google their email address and see this page
I don't see any email addresses in that URL, but from the sound of things, it seems to imply that there is a GET-method request involved in a password change.  You must never use a GET request that makes any change to the data model.  This is closely akin to AntiPractices #15 and #18.  There are many reasons for these rules, but rather than me try to explain all them, please look up the HTTP protocols and learn about the important difference between GET and POST requests.
0
rgb192Author Commented:
I already used webmaster tools.

I think the best answer is a name change.

But I can not prove.


Takes many days, weeks, months, years to prove search engine optimization.

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.