From Server Knowledge Base
Jump to navigationJump to search

Wordpress and .htaccess

Add Options +FollowSymLinks if you get the below error on Wordpress sites:

Forbidden, perhaps you need to change the file permissions for this document or upload an index page

For Pretty Permalinks this is the .htaccess template:

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

The fix for "404 not found , the requested URL was not found on this server" for me was Aleksandar Jakovljevic's answer http://stackoverflow.com/questions/29074376/404-not-found-the-requested-url-url-name-not-found-on-this-server-in-wordp

The dangers of 777 permissions

If folders/files are set to 777 this can cause escalated conflicts. This could lead to your server being compromised and future errors.

Uploading images or videos fails

When you go into the following place in Plesk:

- Domain/Webspace control panel
- Applications tab
- Manage Installed Applications
- Click the value under Name (normally Wordpress Instance)
- Administrative interface
- Pages

And uploading an image or video fails and you get HTTP Error or 500 Internal Server Error this is normally caused by the following three settings and should be changed in this order:

  • Ensure the domain is using PHP Support as Fast CGI
  • Navigate to /etc/apache2/mods-available/ or /etc/httpd/conf.d/ in SSH
  • Edit the CGI (cgid.conf)/Fast CGI (fcgid.conf) configuration file (depends what the Apache module is for that domain)
  • Add in one of the below values in between the <IfModule> and </IfModule> tags. It should appear in white if correct.
FcgidMaxRequestLen 134217728
FcgidMaxRequestLen 268435456
FcgidMaxRequestLen 536870912
#or cgid for CGI
  • Restart Apache by using /etc/init.d/apache2 restart or /etc/init.d/httpd restart
  • Check the user:group that is set for other Wordpress folders
  • Change the user/group for wp-content/uploads (normally from www-data) to chown -R ftpuser:psacln /var/www/vhosts/domain.com/httpdocs/wp-content/uploads/
  • Remove the mod security entry from .htaccess or the file itself.


Fast CGI Configuration files


Additional notes:

- MaxRequestLen is a setting that determines the max file size upload
- mod security was blocking user agent of the flas user

Comment out

Text to ignore

Disable comments


Either comment, delete or set to false.

<?php comments_template( , true ); ?>

On the Mantra theme: Appearance > Mantra settings > Post information settings > Post comments link - Hide

and then in comments.php remove the line <?php comment_form(); ?>

Disable the Sidebar

You can do this either for all pages, just one or multiple pages.



Or remove <?php get_sidebar(); ?> from page.php

Error Establishing a Database Connection

This is normally caused by the following settings being wrong in wp-config.php:

define('DB_NAME', 'databasename');

/** MySQL database username */
define('DB_USER', 'user');

/** MySQL database password */
define('DB_PASSWORD', 'userpasswordhere');

/** MySQL hostname */
define('DB_HOST', 'localhost');

A good guide is here on Youtube.




In order to improve site performance for your Wordpress driven site, you can disable caching plugins on your site by logging into the Wordpress admin dashboard for your site and disable any caching plugins found under the plugins menu. The 2 most popular caching plugins used within Wordpress are WP-super-cache and W3-total-cache


Asks for FTP account while trying to install

To stop it prompting for FTP credentials do:

echo "" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php
echo "define('FS_METHOD', 'direct');" >> /var/www/vhosts/yourdomain.co.uk/wp-config.php

Intergrate with MSSQL

Wordpress requires MySQL to run and most plugins use MYSQL, any plugin would need to be rewritten to use MSSQL.