Redirect JUST the "/blog/" page without redirecting the entire "/blog/" director (11 posts)

  1. FitBuffcom
    Posted 7 years ago #

    Is there a way to do a permanent redirect on just the http://www.domain.com/blog/ page, without making it so that the entire /blog/ directory is redirected?

    This would be easy if it was a page like http://www.domain.com/blog.php because that's clearly just a single page, but it's giving me some complications in that WP can have a single page with a name like http://www.domain.com/blog/
    so it thinks when I redirect that one page, that I want to redirect all the pages in the /blog/ directory as well.

    So is there a way to redirect a single page whose file name is set up like "/blog/"?

    Thanks in advance.

  2. FitBuffcom
    Posted 7 years ago #

    Anybody get what I mean by redirecting just the page, without redirecting the entire directory?

  3. FitBuffcom
    Posted 7 years ago #

    I've searched high and low and still can't find a solution to this problem. If anyone has any information on links that address this issue, please let me know.

  4. moshu
    Posted 7 years ago #

    No, nobody can get what you want because you did NOT describe clearly what the basic/existing situation is.
    Do you have a directory called blog and a Page called blog? How they relate to each other?
    Where is your WP install? In the root or in the blog directory? What is that "blog" Page?

  5. FitBuffcom
    Posted 7 years ago #

    Do you have a directory called blog and a Page called blog?

    Yes, I used to have it set up my WP was in /blog/ but now it's in the root. My permalinks USED to look like this ".../blog/DATE/TITLE/"

    Now I've moved my blog to the root directory and changed the permalinks so all the NEW posts look like this ".../TITLE/"

    I also have a single PAGE at ".../blog/" where my OLD blog posts used to be.

    I would like to redirect just that one PAGE of ".../blog/" to my new index page at ".../"

    But if I set up a redirect for just ".../blog/" then it also interprets that redirect for all my OLD permalinks, thus changing them from ".../blog/DATE/TITLE" to ".../DATE/TITLE/" which gives 404 errors to anyone trying to access old posts.

    So my problem is trying to redirect just the SINGLE PAGE of ".../blog/" without it interpreting that as the directory.

    This would be easy if it was a normal page like ".../blog.php" but the way the page link is set up in WP, I can't find a way to redirect JUST that page of ".../blog/" to the index without breaking all the old post links of ".../blog/DATE/TITLE/"

    Please let me know if you know of any way to fix this, or if you need any more information.

  6. moshu
    Posted 7 years ago #

    I think, you problem is NOT with the page or Page named "blog". It is because of the changed permalinks.
    I am no expert in htaccess redirects (I had to ask for help here in the forum) - but I succeed to redirect from an old location to a new one ONLY by keeping the same permalink structure. I know, this is not good news and maybe somebody has a better idea.

  7. FitBuffcom
    Posted 7 years ago #

    Technically there isn't exactly a "problem", because right now all the pages and links work, so the permalinks are fine.

    But forgetting about the permalinks or directories or anything else, my main question is how do you redirect a single PAGE without redirecting the entire directory, when the name of that one PAGE is structured like, ".../blog/"

    I know there has to be a way to do this in the .htaccess with just a simple tweak of a quote or a slash here or there, but I can't find how to do it.

    I know you said you're no htaccess expert, but thanks for trying, and does anyone else know more about .htaccess that could help?

  8. moshu
    Posted 7 years ago #

    Man, you can NOT have a Page and a directory with the same name.

  9. FitBuffcom
    Posted 7 years ago #

    You mean I should not right? I know that now, but I didn't when I created the page, so I'm still looking for a way to redirect a page that's structured like ".../page/" instead of just ".../page.html"

  10. whooami
    Posted 7 years ago #

    You mean I should not right?

    No, actually, you cannot. Just like Moshu said. No UNIX based file system will allow you to do it, for good reason. And Apache and mod_rewrite wont handle attempts to fake it well either.

    ie, :

    [whoo@box ~]$ cd html
    [whoo@box html]$ touch page
    [whoo@box html]$ ls
    [whoo@box html]$ mkdir page
    mkdir: cannot create directory 'page': File exists
    [whoo@box html]$

    UNIX based filesystems make no differentiation between directories and files -- in the way that windows does.

    A directory, to NIX, is a file.
    A file, to NIX, is a file.

    Everything is a file.

  11. FitBuffcom
    Posted 7 years ago #

    Well I do indeed have a page and a directory both named /blog/

    You can see for yourself with the following links:

    Here is a single page called blog: http://www.fitbuff.com/blog/

    And here is a link to an old post when my blog was in the /blog/ directory (it redirects now, but I still can't get JUST the single /blog/ page to redirect:


    Now, all I want to do is redirect the single page of http://www.fitbuff.com/blog/ to http://www.fitbuff.com

    BUT, if I do that using an .htaccess redirect, it also interprets the /blog/ as the directory, thus when someone clicked on an old link such as the one above, it would strip out the /blog making it: http://www.fitbuff.com/2007/05/30/train-like-a-samurai-warrior/ which leads to a 404 because that link never existed.

    See my problem? and Does anyone have any idea how to redirect JUST the page /blog/ without the .htaccess applying the redirect to the old directory of /blog/ as well?

Topic Closed

This topic has been closed to new replies.

About this Topic