How to fix 404 not found WordPress permalinks on a Google Cloud instance?

Are you getting 404 errors when you try to visit pages or posts through their normal links on your WordPress site? When it comes to a WordPress site, few things are more important than permalinks.

Permalinks also keep your links looking nice and clean, rather than some long string of id numbers like: example.com/post.php?id=91824.

Things That Can Break Permalinks In WordPress

There are some case that can be break permalinks in WordPress. Let’s take a quick look at them.

1. Installing New Plugins

If you install a new plugin that tries to deal with permalinks, you may encounter an incompatibility that ends up breaking your permalinks.

2. Updates

Whether you update WordPress core, a plugin or your theme, this can actually break your permalinks if you’re unlucky.

It could for example be the result of an incompatibility between the theme or a plugin and the new version of WordPress, or incompatibilities between the new version of the theme or plugin you updated and other plugins.

3. Migrating Site/Restoring Back Up

If you are migrating your site to a new domain or server, or restoring a backup, you can end up breaking your permalinks.

You can do this if you’re using a plugin or service and you face an unexpected bug/error. Or if you do it manually and make a small mistake.

If you a migrating to a new server and you are getting issues, it is quite likely that your issues have to do with the FTP permissions of your .htaccess file. (If this is you, jump to the changing permissions of your .htaccess file section.)

4. File Permissions Or Other Changes To .htaccess File

Your .htaccess file is basically a file that decides who/what gets to do see/use what files on your site. Lately people might focus on how it can be used to defend against bots and other malicious attacks, but it is also what is used to create permalinks in WordPress.

Sometimes file permissions can change without apparent reason. Maybe your host implemented a site-wide sweep, changing permissions on every file of every client in an attempt to improve overall security.

How To Fix Broken Permalinks In WordPress

All you need to fix broken permalinks is access to your WP Dashboard, google cloud credentials to access your server, and a little bit of patience.

1.   Use Day and name Permalink setting.

Select the Day and name radio button then add include /index.php/ in custom structure.

Then click the save. Now your link is working fine. With below format

https://www.example.com/index.php/abc

If you want to show your link as per post permalink. Follow the 2nd step.

2. Enable Apache allowOverride Using SSH.

Go to WordPress setting then go to permalink and select the post permanent and click over the save button

Now Go to the Google cloud console.

  • Select your project
  • Click over VM instance

Below page will be open-Click on SSH button to connect VM instance. After Clicking on SSH button new window page will be open.

sudo nano /etc/apache2/apache2.conf

 

Go to the WordPress directory and change “AllowOverride” None to All. Please refer below image for the same.

After change the code press ctrl+ X  than press Y  to save the code .

Press Enter and Put below command line to restart the apache2 server.

“sudo service apache2 restart

  

Now you can check .Your permalinks are working fine.

7 thoughts on “How to fix 404 not found WordPress permalinks on a Google Cloud instance?”

  1. Saeed Ali Lakho

    Thanks For Create Such Kind Of Informative Website. All Content Is Relevant To Your Subject. Keep It Continue, Because Your Website And Subject Is Meaningful For The Users. After See Your Niche I Have Recommended Your Website With My Friends Also. Mental Health awareness is great job. amazing Articles Read more👉🌐 The Top Articles

Leave a Reply