Thursday, May 5, 2016

Internal links not working in WordPress -404 error

This is a strange thing which I faced today. Neither My WordPress is updated nor I have shifted my hosting. So why my internal links were having 404 error? You may get internal links not working error in two ways. Either it is directing to blank pages which mostly happens when you are shifting hosting. The other one is error 404 which occurs mostly when you have tried to change the permalink structure in WordPress Dashboard.
I know internal links not working notion is a horrifying thing as search engine option depends a lot on internal link building. So let us find a solution for internal links not working problem.


Internal links directing to blank pages

If your internal linked pages is directing to a blank page instead of any error then an easy solution is to uninstall your cache plugin. I am using WP Super Cache on this site. After uninstalling (Deactivating and Deleting) the Super Cache my internal pages were working fine.
Do not be scared about the site loading time as you can reinstall the Cache plugin there after.
I hope it solves your problem for internal links directing to blank pages.

Internal links not working -404 error

When I tried to change my default permalink settings I had the 404 error and none of my internal links were working. It said that either the page has moved or the url have got changed and most shocking that the page no more exists. But neither have I shifted my hosting or updated WordPress which are common to have such issues. So what did exactly happen?
Internal links not working
After surfing into support forums it said that I have to set to my default settings back in order to get my links activated But I do not like my default settings style and design. So what to do now to change in the preferred structure?


WordPress Dashboard>Settings>Permalinks

Internal links not working


Why to change your permalink structure ?

Most of the time I tell people to change their WordPress permalink structure, it’s to get rid of the dates in their permalink structure. If their content is “timeless”, it just shouldn’t be there~ Yoast change permalink structure
My default permalink structure was composed of month and date and I wanted it to change in Post Types. When you suddenly change your permalink structure then it will work fine with your new posts but your old posts will be showing error 404. The solution is to edit .htaccess file which you can find it root directory of your WordPress site.
You can edit your htaccess file directly as explained below or you can generate redirect code from Yoast SEO and simply add the code in the file content.

[wp_ad_camp_1]

Using Yoast Seo Plugin

Yoast seo plugin offers an option to GENERATE REDIRECTS
By using the generate redirects option you will be able to redirect your old permalink structure to the /%postname%/ permalink structure. 

A short Tutorial

  1. Internal links not working
Put the url of your site with http or https. Example: http:/frolicpost.com/
2.Internal links not working
You can keep it blank.
3. Internal links not working

Here you need to put your old permalink structure. For me it was set as month and time so click on the radio button and Generate Redirect.
4. After clicking on the generate button you will be given a redirect match which you need to add to your .htaccess file.

Internal links not working

 

Where to find .htaccess file

Which hosting are you using? My site frolicpost.com is hosted by GoDaddy.com.
If you are even hosted from other services then Go to CPanel>Hosting>File manager
Internal links not working

You will be given few options. Click on the Web Root directory . Click on show hidden files.
Internal links not working

A page will be opened containing the .htaccess file.

Internal links not workinginternal links
not working


How to edit .htaccess file

.htaccess file can be accessed and edited in many ways.
  1. You can use FileZilla which is a FTP client to access your file manager files.
  2. CPanel File manager is the one by which I edit my .htaccess files. Simply RIGHT CLICK on the .htaccess file and click on edit.
  3. Yoast SEO also provides with .htaccess file editor if you are using the Premium Yoast SEO.
  4. There are also plugins of WordPress like htaccess editor which will help you to edit your file in root directory of your site.

How to redirect .htaccess file for internal links error 404

2 process by which you can overcome the 404 error of your internal links and change it to /%postname%/ permalink structure.

.htaccess file edit

Write the following default code in your .htaccess file edit. It worked earlier for me. It does not work with my latest WordPress version. I do not know what version you are using. So, if it is not working for you then follow the next option which will work perfectly.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Yoast RedirectMatch 301

As I have already mentioned how to get the Yoast RedirectMatch code earlier which needs to be added to our existing .htaccess file at the top. Simply copy the code and add it to the top of the content.
Internal links not workinginternal links
not working

That is it. Editing the .htaccess file is the easiest solution from internal links not working to internal links not working. If you are facing any other problem for internal links error then comment below and I shall get back to you.



No comments:

Post a Comment