404 page redirects and SEO - php

I hope this is OK to ask here. I am almost ready to upload a new theme to my blog. Which after some serious consideration and research in SEO I have decided to restructure some of the pages, their child pages and to remove some of the categories.
Unfortunately this will result in various 404 results which will be bad for my site.
What I want to do is this:
On the 404 page, before it loads get last parameter of url, so for example: example.com/parent/child-page-name/
Then perform a check in wordpress using get_page_by_title().
If the page exists get the page permalink then use php header location to send 301 redirect to the new page.
if not, display 404 page with search options etc..
Is this a good way to handle this? is 301 the correct redirect?

To answer your redirect question, yes the 301 redirect is the correct one to use as it passes on the link equity from the last page.
Rather than using PHP to automatically solve your 404 problem when the new blog is launched, I'd crawl your website first and manually redirect all the old links to the new ones. It's tedious, but it will make sure nothing slips through the cracks that an automated process may otherwise miss.
A good way to do this is to crawl your site as it is at the moment, put all the links into a spreadsheet and put the new urls into the next column. From there you can concatenate the urls into a rewrite rule for the .htaccess file.
To show you what I mean, I have set up a basic sheet you can use to help you out.
https://docs.google.com/spreadsheets/d/1htHq0oeATsfrFJpAxKg0_e5dJqSmJ_idrrH-tudkuq4/edit?usp=sharing
Source: Past experience, Commercial SEO Technician for 2 years

Related

WordPress: Automatic 301 redirect after page deleted

I have a wordpress website with dynamic content via API. every day we have hundreds of new content pages and hundreds of old pages that been deleted automatically. Is there a solution to create a automatic 301 redirect for this pages? The goal is to avoid thousands of 404 pages after a few weeks...
1a. Decide what you'll redirect TO.
Figuring where any particular OLD/missing url should be redirected to can be as simple [generic url] or complex [pattern-matching-language-AI] as you need. At the very least, you should probably try to match up similar articles by a few fields: url, title, meta, keywords, H-tags in content.
Redirecting to one common url IS a 404, whether you tell people it's a 301 or not.
Ultimately, if you're just going to redirect them all to one page, why bother with a redirect at all? What you've just built is a 404-page that will never 404, but will have the same effect on SEO. Instead, just customize your 404 page with that content.
1b. Categorize ALL pages. Redirect the Category page.
Setting some basic requirements for how your imported content will be organized will drastically simplify your problem. If you can lump these pages into some basic standard categories (which won't change, and need not be displayed in nav anywhere), your problem is 90% solved. The last step is then to simply create some simple rewrite rules from step 2a: url matches a category and page missing? 301 to category.
2a. Learn and apply your own rules with the Rewrite API.
This is not an uncommon problem, that's why there's a tool for it built-in to WP: the Rewrite API. This lets you add your own rewrite rules (matching Requested URL to specific Responses) to WP, to let WP do the rest.
I'm not going to tell you it will be easy, but it is the best solution, if you intended on proceeding despite my advice at the end.
2b. Catch-all requests, and wp_redirect before WP loads a 404.
Warning: here be dragons
Wordpress uses .htaccess to route most requests to index.php, which itself acts as the main loader for all of WP. There are plenty of places in this process into which you could inject your own url-rewrite engine, effectively replacing wordpress for handling any of your predefined URLs. Once you're there, you can pretty much do anything with the request, but I'd suggest sticking to something simple, like wp_redirect( "http://example.com/new-page", 301 );
Please: Let your 404s be 404s, or only redirect to the page's old category.
There's a reason why this behavior is part of a well-defined standard for request/response cycles. Not just in HTTP, but this is one of 4 basic response states for ALL forms of communication responses: didn't-catch-that, my-answer, i-don't-know, choking. You ever worked with someone who never admits to themselves that they don't know something? That's what you'll be turning your site into.
Effectively, you're trying to save SEO for missing URLs, and to avoid massive amounts of 404 errors. To do it, at best you'll be directing old urls to completely unrelated content most of the time. This is effectively the same impact on SEO as showing a 404 page.
More on this at moz.com.

Changing URLs in WordPress from having month and year to not having them

At the moment I have a WordPress site which has some posts and the links for those look like this:
http://www.example.com/2015/09/some-post
I need to change those URL's to
http://www.example.com/some-post
which is easy enough but I want also to make the old links redirect to the new links automatically. Is there a way to do this with a plugin or in the .htaccess file or in some other way?
Yes, certainly you can do it either way. Via .htaccess redirect, or using a redirection plugin. Or you can use both at the same time.
However, assuming you are doing this for SEO purposes, and want to redirect previously linked URLs in order to pass any existing "link juice" to the new link, then you really should consider the plugin approach first.
The best feature of these plugins is the overall logging, mapping, and administration of your URL redirection plan. You will want to make sure all your old URLS are returning an HTTP 301 Moved Permanently response code, and not a 302 Moved Temporarily, or worse a 404. These plugins are great for this type of redirection task, and will quickly allow you to see if your old links are being redirected properly. Incorrect redirection of old links will result in loss of the link power/equity you may already have on those links.

wordpress rewrite and google SEO issue

I have a custom wordpress page that I wanted to make its url SEO friendly.
So I added some code using rewrite api to convert this url:
http://example.com/page1/?id=1234
to:
http://example.com/page2/1234
page1 is still there and first url still valid. page1 was not very descriptive so I though that since I'm rewriting the url I might as well rename the page too.
Everything on the website works fine, but when I recreated the sitmap xml file and resubmitted to google I was hoping google would forget the old url and start showing the new one. This was a few weeks ago and I'm still seeing old urls. Any idea how I can remove the old urls? Do I need to physically rename the page itself?
Please help.
Thanks
Since google has indexed old URLs, it will stay in their index unless you do something about it. There are two options you can handle.
If you want the old urls to coexist, you can do rel="canonical" on the old URL pages. Canonical will indicate that they are same pages with different urls.
Other option is doing 301 redirect. 301 indicates that the page has moved permanently and it helps search engines to carry over the SEO values of the old urls to the new ones. In due course search engines will index the new urls and old urls will go away. After a certain point in time, once you are sure that old URLs are not receiving any traffic, you can get rid of the redirect rule.

How to delete broken/dead links in Joomla 1.5?

I'm working on an old project based on Joomla 1.5. Most of its code was written in core php but it does have SEO URLs. I'm required remove dead links (about 2000 URLs) from the site as it is lowering our organic reach.
When I opened each of them, they showed me the 404 Error page of the site. I couldn't figure out what was wrong with that. After all, that's why we have 404 pages, right? .. to display errors when a link is not found over our server, right?
I tried cleaning up Server's Cache and even purging expired cache after reading some tuts. Now that it doesn't seem to help, I'm not sure what to do! So, any helps?
Btw, site is at www.parentune.com
and an example dead link is: http://www.parentune.com/parenting-blog/category/Adoption/latest
You don't have something to remove as it doesn't exist in your site.
You have to create 301 redirects for old url to new to help search engine crawl your updated content.
A 301 redirect example is:
Redirect 301 /oldpage.html /newpage.html
Good Luck!
As I didn't have any new URLs to redirect those old URLs to, but had the list of those reported URLs in an excel file, so what I did is I read the Excel file in an array and matched if $_SERVER['REQUEST_URI'] was in that array (obviously, all the URLs in that array have to be relative to index page). If the URL was found in the array, I simply redirected the page to homepage.
I also cross checked then on brokenlinkcheck.com and then it didn't report those URLs again as 404 URLs. So, seems like the approach fitted as solution! :D

maintain SEO of a website on platform change?

i have a site url
http://www.dualfocusphotography.co.uk
i want to convert it to word-press in such a way its SEO or site ranking should not be disturbed.
any one guide me is it possible if yes then how?
any help or relevant-materiel would be appreciated.
The main SEO issue when you try to move your site into wordpress is with the old indexed URLs by Google.
You must set "301 moved permanently status" to all of your old main urls.
You have to set an effective 404 page for error pages (WP had one).
Check for the main keywords through which people reached your site & retain those keywords. Generate new site map & submit in Google webmaster.
Migrate as quick as possible.
After migrating use WP SEO plugin & use keyword sparingly.
Use SEO friendly permalink structure.
Use twitter & facebook plugin's for socializing with virtual world.
Some useful links
https://seogadget.co.uk/surviving-seo-site-migration/
http://www.techwyse.com/blog/search-engine-optimization/5-tips-for-effective-seo-site-migration/
To keep your rankings, you should define what pages are the most important(have backlinks and are most visited and make sure you set redirects 301 on them.
There is a redirection plugin for wordpress to check for broken links. Doing redirect for all pages can affect the performance, that's why it is better to redirect the most important ones. This way you'll retain your rankings, however, a certain drop is unavoidable.
As long as you keep the same URLs, it won't matter if you are using from-scratch HTML pages or Wordpress. If you want to change the content around and will have new URLs, you'll need to do 301 redirects from each old page to each new page.
For example, the old page might have been oldsite.com/services.html, you'll do a 301 redirect to newsite.com/location/services
the 301 redirects are done in the .htaccess file.
I just wrote an article on how to SEO your wordpress site that might help you as well
Let me know if you need any help.
When migrating to a new CMS, try to keep your domain unchanged. If that's not possible, you should set up 301 permanent redirect to the following pages: homepage, most popular pages that get lots of traffic (check your analytics for them), pages with backlinks.
Also, when you change the URL structure, try to include your keywords
into the address
Check your robots.txt file - whether it;s indexing correctly
Generate the new xml sitemap and submit it via google webmaster
tools.
WordPress has it's own powerfll plugins for SEO. I suggest you use those.

Categories