Forums

WordPress is over-riding my Redirects (4 posts)

  1. lkendrick
    Member
    Posted 1 year ago #

    I appreciate any help you can provide with this problem.

    I used to have WordPress installed in a subdirectory folder (labeled 'blog'), but moved it to the main public_html folder a few days ago.

    Since then, I haven't been able to setup redirects in my cPanel. Some of my old redirects don't work now. And, my 400.shtml, 401.shtml, 403.shtml, 404.shtml, and 500.shtml pages aren't appearing.

    Instead, everything is being redirected to a sample blog post... titles "Not Found" which says "Sorry, but you are looking for something that isn't here." in the body of the post.

    *** I want all page errors to go to my .shtml pages.

    *** I need to be able to setup redirects, so I can mask ugly affiliate IDs.

    Thanks again for your help.

    Lee Kendrick

    I had previously setup these .shtml pages to show an affiliate product I'm promoting.

  2. whooami
    Member
    Posted 1 year ago #

    there are ways to override wordpress displaying your theme's 404.php, OR index.php, in the event you dont have a 404.php.

    I cant find the threads though, so here is another idea.

    Create a 404.php, put it in your theme directory

    and place this in it:

    header('Location: http://www.example.com/404.shtml');

    I dont think that 403s and whatnot are handled by WP.

    Once thing you might want to do is make sure that your error pages are defined in your .htaccess before the WordPress stuff.

  3. lkendrick
    Member
    Posted 1 year ago #

    Thanks for your reply. I created a 404.php file, added
    header('Location: http://www.leekendrick.com/404.shtml');
    to the 404.php file (with nothing else in it).

    When I typed http://leekendrick.com/ewdfghn (a missing page) into my browser, the page that displayed was completely blank... except the string of code I added to the new 404.php file appeared on the page.

    Any other ideas? Or do you know what I did wrong?

    I've got my 404.shtml page setup in the /public_html directory (where my blog is installed). I use my blog as y site (not in a subdirectory), if that helps you any.

    I'm not quite sure what you meant by "defining my error pages in my .htaccess file. I haven't ever ameneded my .htaccess file.

    Thanks again for your help, and pray you'll be able to help me find a solution.

    Lee

  4. whooami
    Member
    Posted 1 year ago #

    uh yerah
    what I gave you is php, you have to wrap it in php tags :)

    <?php
    header('Location: http://www.example.com/404.shtml');
    ?>

    :P try that

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags