0

I want to power my website from http://www.example.com and not from http://www.example.com/foldername

I've completed this task and this is working but before people actually get to the WordPress website they must pass another website-page. See the scheme below.

www.example.com: shows a page with some information and a link to navigate to the wp site.

My problem now is that when I follow the steps on http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory, my index file is fighting with the one from WordPress. I hope people understand the problem.

EDIT

Changing .htaccess to:

DirectoryIndex home.htm index3.php index.htm index.html default.htm

This is working to change the homepage, but as soon you are on the WordPress website and you click on home in the menu, you get back to the homepage set in the .htaccess file.

1
  • Why don't you change the menu to point to index.php?
    – Steve
    Feb 3, 2013 at 23:38

1 Answer 1

1

Here is the code to put in your functions.php file, it will show the splash-page.php only to outside visitors (by checking the referer). Make a splash-page.php in your current theme directory and edit the domain (example.com) in the code:

add_action('template_redirect','my_splash_page');      
function my_splash_page(){ 
    $referer = $_SERVER['HTTP_REFERER'];
    $referer_parse = parse_url($referer);
    if(is_front_page()){
        // let visitors see the normal wordpress homepage if they are browsing your web
        if($referer_parse['host'] == "example.com" || $referer_parse['host'] == "www.example.com") {

        // let visitors see the splash page if they are visiting directly or from another pages
        } else {
            include(TEMPLATEPATH.'/splash-page.php');
            exit();
        }
    }
}
4
  • Birgire what is the difference between example.com and www.example.com in your example. Feb 4, 2013 at 10:56
  • it's just to cover both cases ;-) It's different between sites if they use www or not.
    – birgire
    Feb 4, 2013 at 11:02
  • Can we continue in chat? Feb 4, 2013 at 11:05
  • ps: please remember to vote on the answer, since we managed to solve it with this method, thanks ;-)
    – birgire
    Feb 5, 2013 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.