Forum Moderators: phranque
Have an noob question. I just changed the file names on one of my sites from old 123.htm names to seo friendly keyword-keyword.htm names. Problem of course is tha the old files are already indexed.
How do I set it up that if someone goes to the old file names through google or whatever they get sent to the new page, and at the same time have SE's phase out the old pages and list the new ones?
I've heard of 301 and 302 redirects but really have no clue which one to use or how.
Any suggestions? Thanks!
Your choices depend on whether you have access to the server configuration, or only to .htaccess. If you have config access, you can use mod_rewrite's RewriteMap directive to make use of a "table" to translate the URLs from old to new. Otherwise, you can use either the RewriteRule directive in mod_rewrite [httpd.apache.org] or one of the Redirect directives in mod_alias [httpd.apache.org] and do the redirects one URL at a time, or by subdirectories if they are well-organized.
Jim
Thanks for the response!
I've got .htaccess access for sure, but I'm really not sure how to use that directive. The pages are well organized, and thankfully its not a large site (only about 15 pages).
Do you have a solid example of how I would rewrite a URL using Alias or mod_rewrite?
How long should I keep the 302 in place? I'm assuming a couple months at least to be sure.
Thanks again for the help!
... and then there's our required-reading list: ;)
Apache mod_rewrite documentation [httpd.apache.org]
Apache URL Rewriting Guide [httpd.apache.org]
Regular Expressions Tutorial [etext.lib.virginia.edu]
Jim
[added] and that's a 301, not a 302. Make sure it's a 301, or you will cause yourself serious grief. Keep it in place for a year, at least (I keep mine until I haven't seen anyone use the old URL for a year, actually). [/added]
I just changed the file names on one of my sites from old 123.htm names to seo friendly keyword-keyword.htm names. Problem of course is tha the old files are already indexed.
Matt - Not exactly responding to your question, but my feeling is that keyword-keyword.htm names really don't do anything for search, but they do look spammy to both users and search engines. Not that engines penalize for them, but I'm sure they do send up a flag. On the other hand, 123.htm is not a particularly user-friendly name.
A question you might consider is whether you have any deep links to any of these pages, how many of these pages are indexed, and how well they are ranking.
If they have inbound links, you definitely want to redirect, using 301s. If not, and if they are not a major source of traffic, you might just want to change the names and let the old pages disappear and the new ones get reindexed. I changed a page name in Google a short time ago... did not do a redirect... and the page was back and ranking in less than a couple of weeks, if even that long, under the new name. But that wasn't the whole site... it was just one page.
Now, I agree that "red-widget-cheap.html" is spammy looking, but right now most pages are generic names, and some like "widgeta.html". Instead of that I'd rather have
"red-widget.html".
That's not too spammy looking or anything is it? I figure it's more usable and might help, even if slightly, in the serps.
I'll give it a shot!
Instead of that I'd rather have "red-widget.html".That's not too spammy looking or anything is it?
By itself, no.... It depends on whether you have hyphens in your domain name too.
If it were widget-world.com/red-widget.html, I would drop the hyphen in the page name and call it "redwidget.html". In the cosmic scheme of things, probably not a huge concern either way.
Redirect 301 /widget20.html [example.com...]