Problem
I want to move a page in a WordPress site to a different location, but I still want the old address to be active and instead redirect to the new address.
Solution
Unfortunatelly as per WordPress 2.7 there isn’t any standard functionallity to accomplish this, so the easiest way to go is to use plugins.
I use Paul Bains EasyRedirect which works for WordPress 2.7 although the description states “compatible up to: 2.2.0″. Just install it and add a tag of the form [redirect url time] to your redirecting page.
And we have to make sure the redirecting page is not showing up in the automatically generated page menu. I use <a href=”http://wordpress.org/extend/plugins/exclude-pages/”>Simon Wheatley’s Exclude Pages plugin</a> for this. This excellent piece of code adds a check box named “Include this page in user menus” to your page administration page. Very convenient.
June 9th, 2009 | Posted in WordPress | No Comments
Problem:
When deploying a Ruby on Rails application using Capistrano and the command rake deploy, you get an error message similar to this:
** [out :: 192.168.0.200] Authentication realm: dev
** [out :: 192.168.0.200] Password for ‘hasse’:
** [out :: 192.168.0.200] subversion is asking for a password
** [out :: 192.168.0.200] Authentication realm: dev
** [out :: 192.168.0.200] Username:
Lösning:
Solution from: http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/:
This is a Capistrano gotcha. One needs to make sure the account can access the Subversion repository.
Log into the application server and check out the repository into a temp directory. For example:
$> cd ~/some/temp/dir
$> svn co http://mydomain.com/svn/repos/my_app
June 9th, 2009 | Posted in Deploying | No Comments
Problem:
You want to force the World Wide Web prefix of your domain name, even though a page was requested without it. For example, if you would like all requests to http://hans-eric.com be redirected to http://www.hans-eric.com
Solution:
Solution from Alister Cameron. It works for Linux/Unix and requires .htaccess file access.
In the web root directory .htaccess file, add the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.alistercameron.com$ [NC]
RewriteRule ^(.*)$ http://www.alistercameron.com/$1 [R=301,L]RewriteCond %{REQUEST_URI} ^/[^.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
</IfModule>
If you are using WordPress, those rules should come before the standard WordPress rules.
June 9th, 2009 | Posted in Hosting, WordPress | No Comments