Fix for GoTryThis v1.x Wordpress permalink issue
Note: This fix is for version 1.x of GoTryThis
I was checking some links on my blog today and realised that when I changed the Wordpress permalink structure it broke GoTryThis. A search revealed a few partial solutions but none of them worked. Here’s how I solved the problem on my blog at soho-internet.com:
1. Go into your theme directory (i.e. wp-content/themes/themedir/) and copy 404.php to wp404.php so that you now have 404.php and wp404.php in your theme directory.
2. Edit 404.php and add some code at the top of the file – just above the line that says:
<?php get_header(); ?>
paste this code in (substitute ‘yourdomain’ with your own domain!):
<?
$url=urlencode($_SERVER["REQUEST_URI"]);
header(“location:http://www.yourdomain.com/gotrythis/gotrythis.php?id=”.substr($url,3));
exit;
?>
…so those first few lines should now look like this:
<?
$url=urlencode($_SERVER["REQUEST_URI"]);
header(“location:http://www.yourdomain.com/gotrythis/gotrythis.php?id=”.substr($url,3));
exit;
?>
<?php get_header(); ?>
That takes care of the 404 redirect to GoTryThis. Next we need to edit the wp404.php page so that it displays correctly.
3. Change the very top line of the file so instead of looking like this:
<? get_header(); ?>
…it looks like this:
<?
require(‘../../../wp-blog-header.php’);
get_header();
?>
All we did there was insert a new ‘require’ line in between the opening PHP tag and the get_header function. Now to tell GoTryThis about the 404 page.
4. In your gotrythis folder there will be a folder called ‘application’ and in the application folder there will be a file called ‘application.php’. Edit that file and look for the line that starts with:
errdoc = “http://www….”
You need to change that setting to point to the wp404.php file. It will then look like:
errdoc = “http://www.yourdomain.com/wp-content/themes/mytheme/wp404.php”
Let me know if you have any success or otherwise with this.