Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Why don't you change the menu to point to index.php? –  Stephen Feb 3 '13 at 23:38

1 Answer 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();
        }
    }
}
share|improve this answer
    
Birgire what is the difference between example.com and www.example.com in your example. –  Niels Jansen Feb 4 '13 at 10:56
    
it's just to cover both cases ;-) It's different between sites if they use www or not. –  birgire Feb 4 '13 at 11:02
    
Can we continue in chat? –  Niels Jansen Feb 4 '13 at 11:05
    
ps: please remember to vote on the answer, since we managed to solve it with this method, thanks ;-) –  birgire Feb 5 '13 at 11:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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