• Resolved webgaya

    (@webgaya)


    I have installed my blog on a subdirectory
    in root directory called blog.

    The address to blog is like below,
    https://www.my-domain-name.com/blog/

    Now I want my root address refers to the
    blog. That means when someone types,
    https://www.my-domain-name.com/
    It should show my blog.

    Here I don’t mean a redirection. I want
    to create an index.php in root folder
    and replace index.html with it.

    My blog’s index.php contains following
    content.


    <?php get_header(); ?>
    <div class=”content”>
    <div class=”primary”>
    <?php include (TEMPLATEPATH . ‘/theloop.php’); ?>
    </div>
    <?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>

    I can’t figure out how to call functions like
    get_header() in my custom made index.php
    which is in root folder.

    Can anyone help me to get this done?

    webgaya.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Kafkaesqui

    (@kafkaesqui)

    I would just copy the index.php from your blog’s directory. That’s the one with the following in it:

    <?php
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>

    If you edit the require line to provide the correct path to wp-blog-header.php:

    require('./blog/wp-blog-header.php');

    it will work just like it does in your blog directory. If you want to customize your home index.php a bit so it’s not an exact duplicate of your blog’s home page, you can copy your theme’s index.php, make what changes you want, and then make sure that:

    <?php require('./blog/wp-blog-header.php'); ?>

    is the very first line.

    articles

    (@articles)

    But remember, if you have the same page in https://www.my-domain-name.com/blog/ and https://www.my-domain-name.com/ google will index both. And they normally do not like duplicates.

    JeremyVisser

    (@jeremyvisser)

    Well then use a robots.txt to fix that.

    User-agent: *
    Disallow: /blog/

    Thread Starter webgaya

    (@webgaya)

    My theme’s index.php contains only the code I mentioned in my post. Noting else like
    require(‘./wp-blog-header.php’);
    That’s the problem I faced.

    webgaya.

    Chris_K

    (@handysolo)

    Re-read kaf’s post.

    Thread Starter webgaya

    (@webgaya)

    I got it done. Sorry for the misunderstanding I was in. I copied the index.php in my “theme” to the root directory. That caused the error.

    Instead I copied the index.php in “blog” directory and made the appropriate change. Thanks for Kafkaesqui and all of you.

    As for duplicate content issue, if I put
    User-agent: *
    Disallow: /blog/

    Then whole my blog won’t be indexed. So I am going to
    forget it for the time being. If you have any suggestion
    on this, please list them.

    Thank you.

    webgaya.

    Thread Starter webgaya

    (@webgaya)

    I should have found this at the very first begining,
    https://codex.www.ads-software.com/Giving_WordPress_Its_Own_Directory

    It was in Options Tab.

    webgaya.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to Set up index.php in Root Folder’ is closed to new replies.