WordPress.org

Ready to get started?Download WordPress

Forums

Require help with 301 redirect (2 posts)

  1. Mkadmin
    Member
    Posted 7 years ago #

    A while back, I moved my blog from a folder (manukhanna.com/blog) on my domain to the root (manukhanna.com). To redirect visitors, I entered the following code in the 404.php file of my theme:

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://manukhanna.com/index.php");
    exit();
    ?>

    The problems I am facing are:
    I have t5wo issues regarding this:

    1. This redirect code comes into play if the requested link is not found, and the visitor is directed to the home page. I actually want that the reader be redirected only if the requested URL has manukhanna.com/blog/* pattern. Else my custom 404 page should display.

    2. As the redirect is in the theme file, every time I change my theme, I have to paste this code in the new 404.php file. I know I can put the code in .htaccess but don't know how to?

    Much appreciate.

  2. Mkadmin
    Member
    Posted 7 years ago #

    Somebody please help.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.