Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using wp_redirect to change the URL of my 404 page:

function show_404($message = 'page not found'){
   wp_redirect(home_url() . '/error/404?m=' . urlencode($message));
   exit();
}

I have created a wordpress page that has a /error/ permalink. It works fine on my local WAMP environment (properly showing my themed 404 page when navigating to localhost/wordpress/pageThatDNE), but when I test it to a real server, I get a The requested URL /error/404 was not found on this server. message. Navigating to mysite.com/error/ gives me a You don't have permission to access /error/ on this server. message. My other pages/permalinks work fine.

Any ideas how to resolve this?

share|improve this question
add comment

1 Answer 1

Because it is looking for the page 404, which is a child of the page /error. Try just doing this:

function show_404($message = 'page not found'){
   wp_redirect(home_url() . '/error?m=' . urlencode($message));
   exit();
}

But your doing it wrong.

You should just use WordPress's internal 404 page, it will save a lot more headaches that will arise in the future. It is as simple as creating a template of 404.php in your current theme directory.

share|improve this answer
    
I did--in fact, page-error.php just contains require_once('404.php'), but I need to change the URL to match the original site. My solution was using wp_redirect and a page. Is there an easier way to change the 404's URL? –  adamdport Oct 8 '12 at 19:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.