Posts tagged wordpress

Using WordPress with SSL

Enable SSL for logins and admin pages in wordpress:

enable SSL on your Apache server:

install WordPress HTTPS

  • check Internal HTTPS Elements
  • check Disable Automatic HTTPS

further steps (not tested by me): Enable complete support for SSL on WordPress

Mac OS X 10.6, PHP und MySQLMac OS X 10.6, PHP and MySQL

Kev Chapman hat eine gute Dokumentation darüber, wie man Apache auf Mac OS X 10.6 verwendet auf seinem Blog. Setting up Apache on Snow Leopard hat sehr viele nützliche Tips und deshalb kopiere ich nur die (für mich) wichtigsten Teile hier her (als Erinnerungshilfe für mich), den Rest bitte bei Kev direkt lesen.

Problem: PHP kann nicht mit dem lokalen mySQL Server sprechen

Lösung: /etc/php.ini.default im Texteditor öffnen und die Zeile mit mysql.default_socket suchen (irgendwo bei Zeile #1213) und in folgendes ändern:

mysql.default_socket = /tmp/mysql.sock

Die Datei speichern und Apache neu starten.

Damit .htaccess im “Sites” Ordner im OS X User Ordner funktioniert, /etc/apache2/users/<username>.conf editieren:

<Directory "/Users/USERNAME/Sites/">
  Options Indexes MultiViews FollowSymLinksAllow
  Override All
  Order allow,deny
  Allow from all

Kev Chapman has a good documentation about how Setting up Apache on Snow Leopard. It’s worth a read and has all you may need to sucessfully setup apache on Mac OS X 10.6.x – therefore i copy only the most important parts here (as a reminder for me):

Problem: PHP can’t talk to the locally running mySQL server

Fix: edit /etc/php.ini.default and find the line containing mysql.default_socket (around line #1213) and change it to:

mysql.default_socket = /tmp/mysql.sock

Save this file and restart the server.

Getting .htaccess to work in your home directory’s Sites folder edit /etc/apache2/users/<username>.conf:

<Directory "/Users/USERNAME/Sites/">
  Options Indexes MultiViews FollowSymLinksAllow
  Override All
  Order allow,deny
  Allow from all

Using WordPress 2.8 and up with a proxy webserver in front

I use a public plain apache server with mod_rewrite to serve my wordpress as i don’t trust php enough to expose it to the world 😉

I wrote and updated a previous post describing what i’ve done to make things work for me, but now with WordPress 2.8 it’s broken, so i had to figure out a fix for this problem again. This is how i’ve done it:

on my public webserver i use this line in the virtual host config:

RewriteRule ^(.*)$$1 [L,P]

The magic is done in my wp-config.php file:

/* That's all, stop editing! Happy blogging. */

// hack for using wordpress behind another apache / mod_rewrite
// config hack:
// set subdir of this worpress installation absolute to this webserver (normally /wordpress)
$local_subdir = '/wordpress';
// set subdir on remote server (normally /)
$remote_subdir = '/';

if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
$old_host = $_SERVER['HTTP_HOST'];
$_SERVER['REQUEST_URI'] = str_replace($local_subdir.'/', $remote_subdir, $_SERVER['REQUEST_URI']);
$_SERVER['SCRIPT_URL'] = str_replace($local_subdir.'/', $remote_subdir, $_SERVER['SCRIPT_URL']);
$_SERVER['SCRIPT_URI'] = str_replace($local_subdir.'/', $remote_subdir, $_SERVER['SCRIPT_URI']);
$_SERVER['SCRIPT_NAME'] = str_replace($local_subdir.'/', $remote_subdir, $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace($local_subdir.'/', $remote_subdir, $_SERVER['PHP_SELF']);
// end of hack

if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');

IMPORTANT: the hacking of the $_SERVER variables has to be done before requiring wp-settings.php!


I had some trouble that rewriting pretty permalinks didn’t work at first. The problem was that I had to enable the use of .htaccess for my wordpress directory in the apache config of my local server:

<Directory /data01/www/ />
 AllowOverride FileInfo

And i had to enter the public webaddress into both of the blog url fields in the general settings of the wordpress admin interface. After that i had to manually tweak my .htaccess file in my wordpress installation:

# BEGIN WordPress
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
# END WordPress

How to hide a worpress instance behind a different apache server with mod_rewrite

I had the need to move my blog running wordpress 2.0.x to a different server, but keeping the domain name on the “old” server. I used mod_rewrite and with a lot of trial and error and some updates i finally got this working solution:
Read More »

Anarchy Media Player

As you might already know, Anarchy Media Player is a way cool javascript-based player solution for playback of media files like .mp3, quicktime movies, flash movies and so on. The very cool thing about that is, all you have to do is to include the anarchy player javascript file into your html document and each and every link to a file ending with .mp3, .mov, .wmv, .flv, … will be magically converted into a media player (thanks to the HTML DOM and javascript 😉 ).

I use the 1.6.5 version and found that when you add a class with “amplink” to your link, the media player will ignore this link! This comes handy if you want to explicitly put a link to a movie file for which you don’t want the mediaplayer magic to happen. Imagine you have a link to a flash video and two links for quicktime movies in high and low quality for download. The link to the .flv should be converted into a media player, the two quicktime links should be left intact – just put a “amplink” class on the two quicktime links and you’re set!

Sprache ändern