Yesterday in MultiSites, MultiNetworks and Page Link To’s! I added two plugins…
Both of these worked great allowing me to go to Settings>Reading and set a different static page for the home or default page on a 301 or 302 redirect.
Here is how…
Let’s assume the following… (but this is not the way it is…)
Say our domain is:
The page I want to always open as my Default or Home page is:
I want the latest post of my blog to open at:
I also want a tab “Blog” on my menu to open to the latest Blog
On the Page menu I created a new page call it something simple like Home! At the bottom put the URL of the page you want to start with, in our case http://example.com/My-Home-Page/ (static or dynamic is ok) and click if you want to make it a 301 or a 302 redirect. You can also open it in a new window if you like that (I do not!).
Now make another new page and call it Blog. Leave it totally empty – it just needs the title.
Switch to Settings>Reading and on Front Page Displays click on static page. For Front page select the title of your redirect page, for example home. Post page is set to our blank page, blog.
That’s it, no whenever anyone browses to your domain alone – they will end up at your Home pages, perhaps a static page on your domain or another domain that links back to your blog page at:
The only problem I had with this was that I already have a default page working and I did not want to change it’s location! So here is what I added to my default script. The domains listed here will have their WordPress Blog as the default page. Because FGBMFI.Net is NOT listed it will default to the normal start up site.
I wrote this script and put it in a file called my-start-page.php
$myDomain = $_SERVER['HTTP_HOST'] ;
// You may want to do something here so that
// $myDomain is just what you want.
// For example no www or with a www...
// CHECK FOR SPECIAL HANDLING FOR WordPress
// Check $myDomain for special handling
$wparray = explode('=', $_SERVER['REQUEST_URI']);
case ('/?p'==$wparray['0']: // For page preview...
require($_SERVER['DOCUMENT_ROOT'] . '/index.php') ; exit;
// This is where your normal start up is run, perhaps...
require($_SERVER['DOCUMENT_ROOT'] . '/home.php') ;
To make this work you have to edit your .htaccess file in your root directory /…
Something like this…
DirectoryIndex my-start-page.php index.php index.html index.htm index.shtml index.cgi index.php3 index.phtml
What is most important is the my-start-page.php is first like this…
DirectoryIndex my-start-page.php index.php
With this setup The FGBMFI.Net home page is:
The FGBMFI.Net blog is:
Just the way I wanted it! The following ARE listed so they start with the latest Blog post as the default.
You can also use the same tools to add a tab on your blog that goes to your site if you start with your blog… For example…
http://vegenesist.com/ has a tab that leads to a small static website. That tab is called VeG and is clearly visible on the Lan the VeGenesist blog.