[resolved] .htaccess forwarding to static front page (3 posts)

  1. Michael_
    Posted 10 years ago #

    Hi *

    I'd like to have a static front page to avoid having the latest posts on the front page.
    I have evaluated Static Front Page, but however there is one issue:

    Q: I want a static front page and a normal blog (...)
    A: Create a category called 'Blog', make it the default category, and put every post in it

    I still want to use categories in a normal manner, therefore this plugin isn't a solution for me.

    Therefore, I have thought about using .htaccess on Apache server.

    E.g. the static page is located at "http://www.blog.com/home/". One could use e.g.
    Redirect / http://www.blog.com/home/

    But this one causes an error. Do you have an idea of such .htaccess rule to change "http://www.blog.com/" to "http://www.blog.com/home/" but to NOT change urls like "http://www.blog.com/about/" or "http://www.blog.com/feed/" etc. ?

    Many thanks in advance.


  2. Austin Matzko
    Posted 10 years ago #

    Michael, I think what you're looking for is something like this:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^$ /index.php?pagename=home [QSA,L]
    which should work assuming you have the normal permalinks working and a page named "home."

    Another option is simply to create a file named home.php and put it into your theme's folder. WordPress will load that file as the blog's home page.

    And if you want to have a static home page and your blog entries in another directory, without using categories, I've written a plugin to do that, although I strongly urge against casual users using it for any version prior to WordPress 2.0, because it does things to the .htaccess file.

  3. Michael_
    Posted 10 years ago #

    Great, many thanks :-)

    Works like a charm! Also, if I enter "http://www.blog.com", it directs me to "http://www.blog.com//index.php?pagename=home" but does not display this weird index.php?... in the browser's url field. Just great. OK, this is what mod_rewrite does :-)

    I need to learn more about regex and also about mod_rewrite since it is a very powerful method for manipulating page requests.
    Also, I will evaluate your plugin.

    Thanks again,

Topic Closed

This topic has been closed to new replies.

About this Topic