Forum Moderators: phranque
Anyway, I am in the process of restructuring a 500+ page site for a non-profit organization. This includes renaming files, creating and moving directories, and moving existing files into new sections. In short - a lot of bookmarks are going to be out of date very quickly and navigation will have changed. While this isn't the best course of action, it's necessary.
What I'd like to do is use an .htaccess file in the root to redirect users to any of the moved pages. Okay, no big deal. The problem is that I really want them to pass through a gateway page FIRST that lets them know the page has been moved and that they should update their bookmarks. Example:
1.) user goes to [mysite.com...]
2.) .htaccess redirects them to [mysite.com...] where they are told of the moved page and asked to update their bookmarks
3.) in 15 seconds, the meta refresh on redirect.php sends them to [mysite.com...]
Now, it seems to me that it would be possible to do this all fairly dynamically. Again, I have very limited experience in both .htaccess and PHP, so try not to laugh to hard at what I came up with:
.htaccess is:
RewriteEngine On
RewriteRule ^oldfolder/oldfile.html$ /redirect.php?to=newfolder/newfile.html
redirect.php (in the root) has these bits of code (the rest is standard HTML):
<meta http-equiv="refresh" content="15;URL=$_GET['to']">
with a paragraph in the body that says "This page has recently moved. You will be redirected to the new page in 15 seconds. Please bookmark the new page accordingly, as this a permanent change. Thank you for your understanding."
Do you see where I'm going with this? I really want to avoid using a dummy page for each changed page with a specific meta redirect. That would involve a lot of time and a lot of unnecessary (or so I see it) files cluttering up the webspace. Suggestions? I realize I'd probably be better off if I went through some tutorials, but at the moment I don't have a lot of time to do that, and even then, I think this is a pretty specific bit of coding. ANY help you can provide would be much appreciated...thanks!
^ How does that solve my problem? Granted, I'm new to this, but wouldn't that just make it clear that the redirect is permanent? That's not my concern, really...
Many websites utilize a 404 that says UPDATE your bookmark here. (per each removed page)
my concern is how to get people to update their bookmarks. This site has a lot of very important information for a set group of people, and the information is updated on a fairly regular basis (3-4 times per week). I'm specifically trying to take care of people who have bookmarked pages, not the casual search engine user.
You could try knocking on their door and informing them that if they don't update their bookmarks by a specific date that you are going to burn their house down ;)
Joking aside. . .there's no way to force a person or web browser to update bookmars (although some browsers have such a utility).
Some webmasters simply have these tools for bookmarks, which make frequent automated requests for pages the browser owner is not even viewing, denied access from their website.
Nor may you require a user to utilize a specific browser.
Additionally, there is no way to require (no matter how focused or competent they may be) that users view your emails in a specific format (html).
If they want to?
They will.
Here's some food for thought:
(sorry Jim Archive org having a bad day)
[clickz.com...]
Can you pass a variable from .htaccess to a PHP page? Because to make my life easier, I'd like to be able to keep all my old pages and new pages links within .htaccess and just pass the information along to the non-specific PHP notification page when necessary. Is passing variables from .htaccess to a PHP page using $_GET even possible? If it is, how do I do it?
.htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^oldfolder/oldpage.html$ redirect.php?to=newfolder/newpage.html [R=301,L]
redirect.php
<meta http-equiv="refresh" content="1;URL=<?php echo $_GET['to']?>">
Pretty simple when I finally figured out what I wanted it to do...worked like a charm. Thanks!
in php:
header ("location: $_GET['to']");
^ Exactly...I know there isn't a "correct" way to do this, because by its very nature, I can't follow the rules and have this happen. JavaScript is out of the question because out of the people I know, as many have it disabled as don't.
Again, all, thanks for the input. Any other suggestions are welcome!
A straight 301 redirect is the best way to tackle this. It matters not whether people update their bookmarks, because you will leave the redirect up permanently.
People will gradually update them over time when they see that the URL has changed.
And that's what I do. For those who are concerned about "cloaking," there's no intent to deceive anyone, and the site has been hand-inspected many times by the SEs (because I often use it to show them their crawler problems). It hasn't been banned yet, even with all that attention from the guys with the "big red button" close to hand.
This is simply user-agent-variant content, and the "Vary" server response header says as much. The intent is to get the "control element" of the client to update the URL, which is accomplished by asking the human user to do so if the client is a browser, or by issuing a 301 redirect if the client is a robot. Slightly different "client control elements," slightly different "protocols" used.
I don't often do this meta-refresh/cloaked-301, but if you saw the site and the specific application of this method, you'd likely agree that it was necessary for usability, and also fairly effective. Because our sites and user bases are all different, everyone's mileage may vary -- Sometimes "Click here" is the best anchor text. ;)
Jim