• Hello,

    I renamed slugs of my pages and it is redirecting to old slug.

    old url: /my-old-page-name/
    new url: /my-new-page-name/

    So now my page was accessible at both URLs. Now if I don’t want this old URL, I will remove it from ‘wp_postmeta’ where meta_key = ‘_wp_old_slug’.

    I have done this but I am still able to access my old url. How could I completely remove this?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You need to delete the old slugs and create new ones. When you rename, the old slogs remain and new ones are created.

    Thread Starter meraj.khattak

    (@merajkhattak)

    I have deleted the all the old slugs. New slugs are in place. But still it is redirecting to the these old URLS.

    Is there any other place where it could be checked for redirection?

    In wordpress when you change slug of a page or post, it keeps old slug in database. And there is a function which auto redirect old slug to the new one.

    If you don’t want redirection on old slug you have to remove it from the database. These can be removed by using following mysql query (link):

    DELETE FROM wp_postmeta WHERE meta_key = '_wp_old_slug';
    Thread Starter meraj.khattak

    (@merajkhattak)

    Thanks Frizax. I have removed old URLs. But it is still accessible via old URLs and it redirects it to new one.

    I have confirmed and don’t have any rules defined in .htaccess for this.

    Clear caches and cookies and try again.

    Thread Starter meraj.khattak

    (@merajkhattak)

    Clearing cache and cooking and then trying again didn’t help. Will look into this more and update.

    Thread Starter meraj.khattak

    (@merajkhattak)

    Solved. I noted that an .htaccess outside my root folder of WordPress was causing this issue.

    What is strange is that the directory in which .htaccess was causing was not even in my DocumentRoot. The structure was as the following:

    • /home/mrk/www/ – This was my DocumentRoot in Apache and WP root as well.
    • /home/mrk/.htaccess – This was causing issue. I don’t know how that was possible when it was not even defined as DocumentRoot for Apache? Probably as parent directory of DocumentRoot?

    Anyway, thanks for all your kind help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Old Slugs Removal’ is closed to new replies.