How to redirect or block access to a folder that points to your subdomain ? (2 posts)

  1. nvblog
    Posted 9 years ago #

    Here is my config.

    My WP->Options->General Configurations are:

    WordPress address (URI):http://blog.wordpress.com/
    Blog address (URI): http://blog.wordpress.com/
    (Above site is taken as an example...)

    Users can access the blog by going to

    Why ?

    but going to

    gives them 404 error, just what I wanted !!

    Can I have that done for

    I shall grealty appreciate your help.

    If you would like to see here is the live site
    http://www.nepalvista.com/blog/index.php (i want to get rid of this one!)

    Please help. I believe TWO DOORS to my blog is a duplicate content!!! I only need one door.

    I shall greatly appreciate your help.

  2. nvblog
    Posted 9 years ago #

    Alright, i figure this out but don't know if this is the correct way to do it. It does what I wanted for now. It blocks access to the folder that is used by the subdomain.

    Inserted this code at the top of index.php file.

    $_SERVER[HTTP_HOST] = strtolower($_SERVER[HTTP_HOST]);
    if($_SERVER[HTTP_HOST]!== "blog.nepalvista.com") {
    <title>Oops, that's the wrong address for this blog!</title>
    <meta name="robots" content="nofollow,noindex">
    Then I gave some message here about the address of my blog but have not provided any links. Users will copy paste the address to their browser to view the site. If I have a link here, i fear search engines will follow... i don't know if that's good even with a rel="nofollow" tag.
    /* Short and sweet */
    define('WP_USE_THEMES', true);

    This has solved my problem, but I don't know if this is the way to do correctly.

    I would love your suggestions and further help. Instead of showing messages to users, should i automatically redirect them to the the blog address (which is the subdomain address blog.nepalvista.com) Will automatic redirection hurt search engines ?

    Thank you in advance for any suggestions, etc.

    WordPress rocks! and i hope future developments makes wordpress blogs free from duplicate contents!!!

    thak you thank you thank and

    "I hope you will visit Nepal someday!"

Topic Closed

This topic has been closed to new replies.

About this Topic