Wordpress

From Server Knowledge Base
Jump to: navigation, 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]
</IfModule>
# 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)
/etc/apache2/mods-available/fcgid.conf
/etc/httpd/conf.d/fcgid.conf
  • Add in one of the below values in between the <IfModule> and </IfModule> tags. It should appear in white if correct.
FcgidMaxRequestLen 134217728
#128MB
FcgidMaxRequestLen 268435456
#256MB
FcgidMaxRequestLen 536870912
#512MB
#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.

http://forum.parallels.com/showthread.php?t=112735

Fast CGI Configuration files

/etc/apache2/mods-available/fcgid.load
/etc/apache2/mods-available/fcgid.conf

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

single.php

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.

http://wordpress.org/support/topic/hide-sidebar-on-pages
http://stackoverflow.com/questions/9323712/how-to-disable-a-sidebar-in-wordpress
http://wordpress.org/support/topic/how-to-remove-sidebar-on-1-page-and-keep-it-on-the-others
http://wordpress.org/support/topic/can-you-hide-the-sidebar-in-a-page
http://www.nannygoatsinpanties.com/how-tos/wordpress-how-to-remove-the-sidebar-for-specific-pages
http://wordpress.org/support/topic/remove-sidebar-in-certain-pages

http://www.maheshchari.com/wordpress-custom-page-template/
http://codex.wordpress.org/Conditional_Tags

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.

Multisite

http://mashable.com/2012/07/26/beginner-guide-wordpress-multisite
http://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multisite

Performance

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

http://www.gowebbaby.com/wordpress-website-running-slow

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.