Difference between revisions of "WordPress"

From vwiki
Jump to navigation Jump to search
m (Added Applications category)
(→‎Send Emails via SMTP Server: Added "Pretty Permalinks")
Line 1: Line 1:
== Configuration ==
== Configuration ==
=== Send Emails via SMTP Server ===
== Pretty Permalinks ==
The WordPress documentation recommends editing your site's <code>.htaccess</code> file in order to set-up pretty looking permalinks <ref>http://codex.wordpress.org/Using_Permalinks</ref>.  However, where possible Apache advise against using a <code>.htaccess</code> file as it can impact a site's performance <ref>http://httpd.apache.org/docs/2.2/howto/htaccess.html</ref>. To do so, update your site's config file as follows...
<pre>
RewriteEngine On
 
RewriteRule ^index\.php$ - [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</pre>
 
Add the above to the config for the site (not within a <code><Directory /></code> subsection for example).  In order to stop Apache looking for an <code>.htaccess</code> file to process, ensure <code> AllowOverride </code> is disabled, for example...
<pre>
<Directory />
    AllowOverride None
 
</Directory>
</pre>
 
== Send Emails via SMTP Server ==
If you need to configure your WordPress install to use an SMTP server then there is no way to achieve this via the existing admin console (there are Plugins that do this though).
If you need to configure your WordPress install to use an SMTP server then there is no way to achieve this via the existing admin console (there are Plugins that do this though).


Line 29: Line 48:


The above was based on http://maisonbisson.com/blog/post/12939/using-wordpress-with-external-smtp-server/
The above was based on http://maisonbisson.com/blog/post/12939/using-wordpress-with-external-smtp-server/
==References==
<references />


[[Category:Applications]]
[[Category:Applications]]
[[Category:Apache]]

Revision as of 13:18, 16 October 2012

Configuration

Pretty Permalinks

The WordPress documentation recommends editing your site's .htaccess file in order to set-up pretty looking permalinks [1]. However, where possible Apache advise against using a .htaccess file as it can impact a site's performance [2]. To do so, update your site's config file as follows...

RewriteEngine On

RewriteRule ^index\.php$ - [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Add the above to the config for the site (not within a <Directory /> subsection for example). In order to stop Apache looking for an .htaccess file to process, ensure AllowOverride is disabled, for example...

<Directory />
    AllowOverride None

</Directory>

Send Emails via SMTP Server

If you need to configure your WordPress install to use an SMTP server then there is no way to achieve this via the existing admin console (there are Plugins that do this though).

Out of the box WordPress will try to use PHP's mail function, which will either try to use sendmail (on Unix) or an external MTA (on Windows). To send emails via an external SMTP server use the procedure below.

Be aware that changes made may be overwritten by software upgrades, and line numbers etc will change.

Procedure below was created using WordPress v3.4.1, will update when neccessary for subsequent releases

  1. Update /wp-includes/pluggable.php to use SMTP
    1. Find the line $phpmailer->isMail();
      • In vi use /$phpmailer->isMail(); to find, should be around line 400
    2. Update it to $phpmailer->isSMTP();
    3. To update the From name in email update $from_name = at around line 320
    4. To update the From email address in email update $from_email = at around line 335
  2. Update /wp-includes/class-phpmailer.php to configure the SMTP server connection settings
    1. Find the line public $Host = ;, should be around line 200, and update with MTA hosts
      • EG public $Host = 'mail.domain.com;mail2.domain.com';
    2. If you need to use a secure connection set public $SMTPSecure to ssl or tls as appropriate
    3. If you need to authenticate with the server set the following...
      • public $SMTPAuth = true;
      • EG public $Username = 'blog-email-account';
      • EG public $Password = 'blog-email-ac-password';

It's a bit of a pain to test, but if you've got comment notifications turned on, create a comment that needs approval and see if you get an approval request.

The above was based on http://maisonbisson.com/blog/post/12939/using-wordpress-with-external-smtp-server/

References