Synology WordPress 404 on Synology after restarting NAS

Each time I restart my NAS (for update reasons), I have errors 404 when trying to reach any post of my WordPress blog, until I re-set permalinks' settings. I finally fixed it by updating my WordPress with latest Synology's package.

Click to Read More

A long time ago, rebooting my NAS started to result systematically in 404 in my WordPress blog. I found a manual fix here: simply resetting WordPress permalinks' settings was solving the problem... until the next reboot :(

But I never understood why rebooting my NAS was resulting in the lost of permalinks' settings. And could find a definitive solution.

I finally took today an hour to reproduce and further investigate the problem (motivated by the shiny sun outside :p). I found that restarting only the WordPress Package was also resulting in this issue. I noticed more precisely that the .htaccess file was deleted when starting the package (not when stopping). I am sure that removing access rights on the .htaccess file for WordPress, as described here for example, would be a solution. But the not best one.

I found the best solution by accident. A long time ago, as I was interested in a version of WordPress more recent than the one available via Synology's packages, I did a manual upgrade with the official WordPress setup. Since that time, I never did an update anymore with Synology's Package Manager, but used the native WordPress update via its own Dashboard:

WordPress-Update

Today, I did a backup of WordPress' installation folders and updated Synolgy's WordPress Package. Once the update accomplished, I noticed that the .htaccess was containing information specific to Synology:

# Synology PHP
AddHandler default-handler .htm .html .shtml
AddHandler php-fastcgi .php
AddType text/html .php
Action php-fastcgi /php56-fpm-handler.fcgi
# Synology PHP

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L] </IfModule>

# END WordPress

And now, when restarting WordPress, the .htaccess is not deleted anymore (and permalink's settings are not lost). There is certainly a good explanation, that I ignore, but at least I won't suffer 404 anymore.

And next time I update manually WordPress, I will pay attention to backup the .htaccess as specially clearly recommended here, as well as merging that .htaccess with the updated one after the update of the Permalinks' structure:

  1. Backup your database. Read Backing Up Your Database for a detailed explanation.
  2. Backup ALL your WordPress files in your WordPress directory. Don't forget your .htaccess file.
  3. Verify the backups you created are there and usable. This is essential.
  4. Ensure first four steps are completed. Do not attempt the upgrade unless you have completed the first four steps.
  5. Delete the old WordPress files on your site, but DO NOT DELETE

    • wp-config.php file;
    • wp-content folder; Special Exception: the wp-content/cache and the wp-content/plugins/widgets folders should be deleted.
    • wp-images folder;
    • wp-includes/languages/ folder--if you are using a language file do not delete that folder;
    • .htaccess file--if you have added custom rules to your .htaccess, do not delete it;
    • robots.txt file--if your blog lives in the root of your site (ie. the blog is the site) and you have created such a file, do not delete it.
  6. Upload the new files from your computer's hard drive to the appropriate WordPress folder on your site.
  7. Run the WordPress upgrade program and follow the instructions on the screen.
  8. Update Permalinks and .htaccess. Update your Permalink Structure and merge the custom rules, if necessary, into your .htaccess file.
  9. Install updated Plugins and Themes. Please review the list of Plugins that work in Version 4.8. Check for Theme Compatibility with 4.8 and ask your Theme author for any new version.

Tips WordPress really slow when accessed on LAN via its Domain Name

Since a few weeks, WordPress is really slow when I access it from my LAN with it's domain name http://beatificabytes.be

The problem was with the name resolution on my PC.

Click to Read More

My blog is hosted on my NAS, that I usually accessed via its netbios name or via its local IP address. But to make it easier for me, I also defined a domain 'beatificabytes.be' on my NAS' DNS Server, with a A Records for www, pointing on the IP of the NAS.

So, I can access my blog locally with either the domain name 'beatificabytes.be' (if I am lazy) or with the fully qualified name 'www.beatificabytes.be'.

The problem is that the actual URL of my blog, defined in WordPress' settings, is 'www.beatificabytes.be'. So, many pages of the blog are referencing scripts and images hosted on on that address 'www.beatificabytes.be'.

And, a few weeks ago, for some unclear reason, my PC started to fail to access my NAS via the url 'www.beatificabytes.be'. I was only able to access it with its netbios name, its IP or the domain name 'beatificabytes.be' (without www).

The reason was an issue with the name resolution on my PC (I thought it was an issue with the "DNS" Server but it was actually due to Avast's feature 'Secure DNS').

Therefore, each page trying to load resources from www.beatificabytes.be was getting timeouts, making the rendering very slow (without any visual notification!)...

I did fix the name resolution issue and I can now access again my blog 'full speed'.

Conclusion, open the Debug window of your browser to look at possible network or script errors ;)