How to correctly change page extensions sitewide not to loose rankings in google - redirect

Moved content from php files to content management system. Changed page extensions from .php to without any extension, like: before some-page.php after some-page
All php pages keep at server, but made redirection in each php file, like header('Location:'. basename($_SERVER['PHP_SELF'],'.php') );. I cannot (do not know how to) do it in .htaccess, because in .htaccess is this code
RewriteRule ^([a-zA-Z0-9_-]+)$ show-content.php?$1
DirectoryIndex show-content.php?index
From google webmasters tools removed previous sitemap and added the new sitemap. See that the new sitemap accepted, but no urls included.
All above I did 3-4 days before. And today see that website dropped down in search results (some pages can not find at all in first pages).
Trying to understand what I did wrong.
Seems the first thing is wrong redirection code. Changed to header('Location:'. basename($_SERVER['PHP_SELF'],'.php'), true, 301 );. Is such code ok?
What else I did wrong?

You definitely need to do a 301 redirect from the old URL (with the extension) to the new URL (without the extension) as this tells Google the page has moved to a new location and you want all links and other SEO goodness (like rankings) need to be "transferred" to the new URL.
You can do the 301 redirect any way you want so using PHP's header() is fine as long as you are redirecting to the right page. Your example should work fine.

Related

Redirects in Ektron 8.6.1

Has anyone played with the new redirect feature in Ektron 8.6?
We tested it (in 8.6.0) before upgrading and were happy with it. But when it came time to do the upgrade, Ektron had released 8.6.1, so we upgraded directly to that.
Now we are having trouble with the redirect feature. (Yes, we should have tested everything again in 8.6.1 before upgrading)
Now if we try to add a redirect rule for an existing page in the CMS, it does not work.
But if we create a redirect rule for a page the does not exist, then try to hit that address, the redirect works fine.
We need the redirects to work for existing pages in the CMS.
To clarify what "working" and "not working" means...
If I have an existing page in the CMS with manual alias of "/erc/lucien.apsx", I can create an entry in the redirect table like this...
Adding this entry generates no errors, but when I visit the page, all I see is the regular old page I created. NOT the Google site it should be redirecting to. I do not get any 404 errors.
But if I create a redirect entry for a page that does not already exist, like this...
It works perfectly. If I try to visit the /erc/fake.apsx address, I end up on the Google site, as expected.
(FYI, we create a "fake" page in the CMS for external content so we can attach metadata to it and make it searchable in taxonomies, but then provide a link to the "real" page. I want to use redirects here so users don't have to do this extra click)
I suspect it might be cache related -- the original URL gets cached as an alias, then subsequent requests to that URL are redirected to the quicklink without the need for a db look up. When you add the redirect, it’s probably not clearing the old item from the cache. I'd try an IIS reset after you add the URL redirect and see if that clears up the issue.
An "outside the box" (of Ektron) answer to this is to place the redirect at the web server rather than in the Aliases section of the Ektron CMS.
The server I work on uses IIS and I have this set up for several pages.

Trying to redirect entire folder to website front page

Our site used to have a blog at oursite.com/blog
Years later, we're still getting many 404s for pages in the /blog/ folder.
How can I use htaccess to redirect the blog folder and all its contents to the front page of our site, oursite.com ?
I have tried a lot of things based on web research but the closet thing I found redirected things like:
oursite.com/blog/?p=3226
to oursite.com/?p=3226
I don't want it to work that way. All blog files no longer exist, so I just want to redirect ALL files from the blog just to the main front page, i.e. oursite.com so:
oursite.com/blog/?p=3226
or
oursite.com/blog/cool-permalink/
or
oursite.com/blog/image.jpg
or
oursite.com/blog/
would ALL simply point to oursite.com
Can you please tell me how to do this? I've spent many hours Googling it unsuccessfully...
Thanks a bunch in advance!
Michael
Create a .htaccess inside the /blog directory.
Add this line to .htaccess
ErrorDocument 404 http://oursite.com
That will take care of any URL that is requested in /blog/
If you want everyone to be redirected if the file doesn't on the whole domain no matter what directory they're in just put the .htaccess in your main directory.
If you are using Apache as your front-end, mod_rewrite is what you want to use. Something like
RewriteEngine On
RewriteRule ^/blog/.* /cool-permalink/ [R]

301 Redirect appears to be losing referrer information

We've just put a new website live and I have varying Url re-writing in place to handle the old indexed pages, performing a 301 redirect to the new equivalent page location on the new site.
We've noticed since the day the new site went live that in Google Analytics, the stats in general have plummeted substantially :(
One of our SEO guys has pointed out that when you click on one of the old indexed pages in google, it correctly 301's to the new location, however, if you view the __utmz Google Analytics cookie, it has 'direct' in it, whereas he believes that should be 'organic'.
He thinks that the referrer information is being lost during the 301 redirect, and as a result, this is being treated as direct traffic instead of organic?
The new website is an ASP.NET 4.0 Web Forms application and is using Routing for the new Url's. I am generating the new route/url for old pages within the global.asax within the Application_BeginRequest routine.
If a 301 is needed for the request, this is the code that is executed:
Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", newUrl);
Response.End();
Is there anything here that would indicate what the problem might be, or any ideas beyond the above what might be causing such an issue?
I located the problem - a silly error on my part with a relative url to a file that accompanies our google analytics tag, working in some locations of the website, but in others, the include was returning a 404! My bad.

Will redirecting a bunch of old dynamic URLs to a single new index page totally bone my pagerank?

I've got half a dozen legacy dynamic URLs and it turns out redirecting them all will require 18 Rewrite directives in my .htaccess file - that seems messy to me.
What I can do however, is redirect all of them to my new start page with a single Redirect directive. It's a tiny site and all the pages people might come in from via google searches are really easily findable from the start page so I'd like to do that however...
I'm worried this might kill the site's modest (but worth maintaining) page rank as several URLs would then be resolving to the same URL and content.
Does anyone know if this would be the case, and if so, if there are strategies to avoid that other then not implementing the above?
Thanks!
Roger.
As long as you do 301 Redirects (permanently moved) vs 302 Redirects (temporarily moved), then all the accumulated page rank from your dozen legacy URLs will transfer to the new url you are redirecting to.
So you will not "lose" the pagerank, it will simply be transfered over to the new URL.
The important thing is to ensure it's a 301 Redirect.

Can RSS readers follow redirects if the url of the feed changes?

We are migrating to a Sharepoint solution and our urls are changing slightly.
Are most RSS readers able to follow redirect links without breaking the feed and making an update manually?
Most of the documentation I'm reading says that this will work for major RSS readers.
I have read in some places that a lot of RSS readers will treat a 301 as a temporary redirect and not update its stored url. Any truth to this?
Assuming you are using a 301 redirect, I would say yes, since any reader worth its salt is built on a compliant HTTP library which will honor the 301 status code and follow the redirect.
Of course, it's not that hard to test with the reader of your choice.
Pretty much every RSS reader - major or minor - will update the feed URL when it encounters a 301 redirect.
In my (limited) experience, most applications will ignore the "permanent" part of a permanent redirect and execute the same logic they would use for a temporary redirect.
It may be necessary to make its site velindekserede about. What to do so to preserve PageRank, link popularity and traffic?
As I understand it, so the solution is called a 301 redirect. It tells search engines that the URL has been permanently moved. How a redirect should be done in a special way. At this link there are different options depending on what kind of server technology you use:
http://www.webconfs.com/how-to-redirect-a-webpage.php
I just tried it in practice. I use PHP itself on all my sites, so I used the PHP instructions:
I ripped all my old page for tags and content and put the small code snippet on the page. Prisoners of the new URL for the page, and saved it. Tested the page by typing the old URL and then redirects worked. To be absolutely sure that redirects are search engine friendly, I used this "Search Engine Friendly Redirect Checker":
http://www.webconfs.com/redirect-check.php
There no disagreement about how well the 301-redirect is working and whether it can transfer an entire site to a new domain (http://www.webmasterworld.com/link_deve ... 135964.htm), but people's experience says that it is good enough. You just make sure that the new URL has the content as the old page had