WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] url rewriting index.php to a Page (7 posts)

  1. tikimaticdotcom
    Member
    Posted 8 years ago #

    well i'm trying to do is automatically redirect index.php to (example) ?page_id=3.
    i've tried htaccess stuff - did not work
    then i tried to replace

    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    which appears when there's no post at all with

    header("Status: 301 Moved Permanently", false, 301);
    header("Location: http://www.asite.com/wp/?page_id=3");
    exit();

    got an error like "header already defined"
    how could i do this? thanx for suggestions & help

    why doing this? huuurrhhhr.... think of me as the non-programmer freak trying to use WP (cos i love it) as a cms not as a blog (that is, with NO posts aaaarrgghhhh)

  2. moshu
    Member
    Posted 8 years ago #

    I am not a programmer either but I helped somebody to make a website that was built exclusively by WP Pages.
    If you could describe more exactly what do you want to achieve, I might be able to understand :) [don't write code, just the idea]

  3. tikimaticdotcom
    Member
    Posted 8 years ago #

    ok here's the idea

    homepage of the site (http://www.asite.com) is a static splash-like one where you can choose beetween two languages. ok. let's click "English". That shall lead you to the English welcome page with an url like http://www.asite.com/wp/?page_id=3.
    The problemo is: http://www.asite.com/wp/index.php (which is indeed WP homepage) is empty - kind of a ghost page. So if a visitor unfortunately directly arrives to the index.php page (ex. thru google), i want him to be rediredted to the page_id=3.

  4. moshu
    Member
    Posted 8 years ago #

    Here is what I'd do:
    Make a home.php template in your theme, it will always take precedence over index.php >> see Template_Hierarchy
    You can have any content you wish on that page, including links to Englsih or anything you code in.
    Even coming from google to "index.php" > they will see home.php.

    This is almost what you described, except the redirect, but if they don't arrive ever to index, than you don't really need it.

    If you have a home.php template, index.php will be used only for displaying archive and category view (if you don't have an archive.php template) - and search results. Creating the proper templates, like archive.php, category.php, search.php, page.php you can style all of them as you want, without having to deal with index. Leave it there, though!

  5. tikimaticdotcom
    Member
    Posted 8 years ago #

    Wow!
    1'000'000 thanx!

  6. tikimaticdotcom
    Member
    Posted 8 years ago #

    The Static Front Page Plugin solves this out easy

  7. linusoft
    Member
    Posted 7 years ago #

    Another question..
    When somebody type the URL http://www.mydomain.com and press enter, the URL will be automatically goes to http://www.mydomain.com/index.php. How will I do that? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic