Skip to main content
Skip to navigation
Blog XML feed

Blog entry archive // Posts from a desiging, gaming, comic-reading nerd

May 30

301 redirects in Symphony

When I launched the new design of my site, I also changed the way URLs were structured causing broken incoming links from search engine traffic. Since I didn’t want Google to think those pages vanished, I needed to create a few 301 redirects to keep my posts showing up in searches. Because of the way Symphony does some RewriteRules in the .htaccess, the default, easy way to add 301 redirects doesn’t quite work as expected. After some asking in the forum and some trial and error I managed to find a different way.

A simple 301 redirect

Most of the time this type of redirect would work just fine

Redirect 301 /2007/04/30/more-psp-hackery-ripping-ps1-games-in-osx/ http://www.joshnichols.com/blog/entry/more-psp-hackery-ripping-ps1-games-in-osx/

With Symphony, this is the resulting link from that redirect

http://www.joshnichols.com/blog/entry/more-psp-hackery-ripping-ps1-games-in-osx/?page=2007/04/30/more-psp-hackery-ripping-ps1-games-in-osx

A ?page= and the old URL is appended to the new URL resulting in a 404 page.

How to do it with Symphony

To get 301 redirects to work in Symphony, you have to create a new set of RewriteRules. In the default Symphony-generated .htaccess, right after this bit of code,

### Symphony 2.0 - Do not edit ###

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /

put in your redirects like this:

### Redirects from old site
RewriteRule ^2007/04/30/more-psp-hackery-ripping-ps1-games-in-osx/$ http://www.joshnichols.com/blog/entry/more-psp-hackery-ripping-ps1-games-in-osx/ [R=301,L]

The bit between the ^ and the $ is the old URL and then the second part, after a space, is the new URL. [R=301,L] means it’s a 301 redirect and to end the RewriteRule. To add more redirects, just add a new RewriteRule on the next line.

If you have a URL to redirect that uses an extension, don’t forget to escape the . with a \ like so:

RewriteRule ^2007/04/30/more-psp-hackery-ripping-ps1-games-in-osx/index\.php$ http://www.joshnichols.com/blog/entry/more-psp-hackery-ripping-ps1-games-in-osx/ [R=301,L]

About this entry

  • Published: May 30, 2008
  • Tags: Symphony
  • Comments: 0

← Previous // Next →

Recent entries

Browse the archive →

Comments // What has been said about this entry

There are no comments, so far.

Leave a comment // Have something to say?

Comment rules

Real names are preferred. Comments are moderated before being published.