WordPress splash page with htaccess?












2















I have a WordPress site set up in the root. I need to set up a temporary splash page to promote an album with an 'enter' button which will lead to the regular site. I know there is a way to do this by moving files to different directories but I'd rather not do that. Is there a simpler way to do this perhaps with htaccess? Or another simpler method?










share|improve this question























  • you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

    – Nimit Dudani
    Oct 5 '11 at 9:15











  • Right, exactly.

    – John
    Oct 5 '11 at 9:36
















2















I have a WordPress site set up in the root. I need to set up a temporary splash page to promote an album with an 'enter' button which will lead to the regular site. I know there is a way to do this by moving files to different directories but I'd rather not do that. Is there a simpler way to do this perhaps with htaccess? Or another simpler method?










share|improve this question























  • you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

    – Nimit Dudani
    Oct 5 '11 at 9:15











  • Right, exactly.

    – John
    Oct 5 '11 at 9:36














2












2








2


2






I have a WordPress site set up in the root. I need to set up a temporary splash page to promote an album with an 'enter' button which will lead to the regular site. I know there is a way to do this by moving files to different directories but I'd rather not do that. Is there a simpler way to do this perhaps with htaccess? Or another simpler method?










share|improve this question














I have a WordPress site set up in the root. I need to set up a temporary splash page to promote an album with an 'enter' button which will lead to the regular site. I know there is a way to do this by moving files to different directories but I'd rather not do that. Is there a simpler way to do this perhaps with htaccess? Or another simpler method?







wordpress .htaccess splash-screen






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 5 '11 at 7:42









JohnJohn

387619




387619













  • you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

    – Nimit Dudani
    Oct 5 '11 at 9:15











  • Right, exactly.

    – John
    Oct 5 '11 at 9:36



















  • you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

    – Nimit Dudani
    Oct 5 '11 at 9:15











  • Right, exactly.

    – John
    Oct 5 '11 at 9:36

















you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

– Nimit Dudani
Oct 5 '11 at 9:15





you mean you want to show splash page when someone open www.yourdomain.com ? once they click on enter they can view main site.

– Nimit Dudani
Oct 5 '11 at 9:15













Right, exactly.

– John
Oct 5 '11 at 9:36





Right, exactly.

– John
Oct 5 '11 at 9:36












3 Answers
3






active

oldest

votes


















4














Quite simple.



add DirectoryIndex splash.php blog.php in your htaccess file.



add splash.php file in your root directory. add splash page code in this file.



copy index.php file and rename new file with name blog.php



Login in wp-admin, Go to setting -> General Settings



Change Site address (URL) value, it should be http://www.yoursite.com/blog.php



That's it!!!!






share|improve this answer































    1














    Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).



    Sample code



    <?php $referrer = $_SERVER['HTTP_REFERER'];
    if (preg_match("/yoursite.com/",$referrer)) {
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    } else {
    header('Location: http://yoursite.com/splash.html');
    }; ?>


    Make sure you have the wordpress comment block on the top of the page.

    No .htaccess tweeks needed.






    share|improve this answer
























    • How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

      – testing
      Nov 26 '12 at 18:35






    • 1





      It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

      – cl0udc0ntr0l
      Apr 24 '13 at 16:22



















    0














    I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:



    <?php $referrer = $_SERVER['HTTP_REFERER'];
    if (preg_match("/great2gether.com/",$referrer) ) {
    define('WP_USE_THEMES', true);
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    } else {
    header('Location: http://great2gether.com/splash.html');
    };
    ?>


    <?php


    Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.



    Hope this helps somebody :)






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7658164%2fwordpress-splash-page-with-htaccess%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4














      Quite simple.



      add DirectoryIndex splash.php blog.php in your htaccess file.



      add splash.php file in your root directory. add splash page code in this file.



      copy index.php file and rename new file with name blog.php



      Login in wp-admin, Go to setting -> General Settings



      Change Site address (URL) value, it should be http://www.yoursite.com/blog.php



      That's it!!!!






      share|improve this answer




























        4














        Quite simple.



        add DirectoryIndex splash.php blog.php in your htaccess file.



        add splash.php file in your root directory. add splash page code in this file.



        copy index.php file and rename new file with name blog.php



        Login in wp-admin, Go to setting -> General Settings



        Change Site address (URL) value, it should be http://www.yoursite.com/blog.php



        That's it!!!!






        share|improve this answer


























          4












          4








          4







          Quite simple.



          add DirectoryIndex splash.php blog.php in your htaccess file.



          add splash.php file in your root directory. add splash page code in this file.



          copy index.php file and rename new file with name blog.php



          Login in wp-admin, Go to setting -> General Settings



          Change Site address (URL) value, it should be http://www.yoursite.com/blog.php



          That's it!!!!






          share|improve this answer













          Quite simple.



          add DirectoryIndex splash.php blog.php in your htaccess file.



          add splash.php file in your root directory. add splash page code in this file.



          copy index.php file and rename new file with name blog.php



          Login in wp-admin, Go to setting -> General Settings



          Change Site address (URL) value, it should be http://www.yoursite.com/blog.php



          That's it!!!!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 5 '11 at 10:39









          Nimit DudaniNimit Dudani

          4,63132442




          4,63132442

























              1














              Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).



              Sample code



              <?php $referrer = $_SERVER['HTTP_REFERER'];
              if (preg_match("/yoursite.com/",$referrer)) {
              define('WP_USE_THEMES', true);
              require('./wp-blog-header.php');
              } else {
              header('Location: http://yoursite.com/splash.html');
              }; ?>


              Make sure you have the wordpress comment block on the top of the page.

              No .htaccess tweeks needed.






              share|improve this answer
























              • How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

                – testing
                Nov 26 '12 at 18:35






              • 1





                It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

                – cl0udc0ntr0l
                Apr 24 '13 at 16:22
















              1














              Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).



              Sample code



              <?php $referrer = $_SERVER['HTTP_REFERER'];
              if (preg_match("/yoursite.com/",$referrer)) {
              define('WP_USE_THEMES', true);
              require('./wp-blog-header.php');
              } else {
              header('Location: http://yoursite.com/splash.html');
              }; ?>


              Make sure you have the wordpress comment block on the top of the page.

              No .htaccess tweeks needed.






              share|improve this answer
























              • How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

                – testing
                Nov 26 '12 at 18:35






              • 1





                It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

                – cl0udc0ntr0l
                Apr 24 '13 at 16:22














              1












              1








              1







              Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).



              Sample code



              <?php $referrer = $_SERVER['HTTP_REFERER'];
              if (preg_match("/yoursite.com/",$referrer)) {
              define('WP_USE_THEMES', true);
              require('./wp-blog-header.php');
              } else {
              header('Location: http://yoursite.com/splash.html');
              }; ?>


              Make sure you have the wordpress comment block on the top of the page.

              No .htaccess tweeks needed.






              share|improve this answer













              Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).



              Sample code



              <?php $referrer = $_SERVER['HTTP_REFERER'];
              if (preg_match("/yoursite.com/",$referrer)) {
              define('WP_USE_THEMES', true);
              require('./wp-blog-header.php');
              } else {
              header('Location: http://yoursite.com/splash.html');
              }; ?>


              Make sure you have the wordpress comment block on the top of the page.

              No .htaccess tweeks needed.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 9 '12 at 18:37









              cl0udc0ntr0lcl0udc0ntr0l

              94113




              94113













              • How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

                – testing
                Nov 26 '12 at 18:35






              • 1





                It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

                – cl0udc0ntr0l
                Apr 24 '13 at 16:22



















              • How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

                – testing
                Nov 26 '12 at 18:35






              • 1





                It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

                – cl0udc0ntr0l
                Apr 24 '13 at 16:22

















              How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

              – testing
              Nov 26 '12 at 18:35





              How does this work? If I click on a link with the URL yoursite.com I don't get the splash page. This is fine as well as desired. But why does this work?

              – testing
              Nov 26 '12 at 18:35




              1




              1





              It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

              – cl0udc0ntr0l
              Apr 24 '13 at 16:22





              It detectes the referring page then matches it against your domain (yoursite.com) with a regular expression. If it matches it loads your wordpress site. If it does not it redirects you to the splash page.

              – cl0udc0ntr0l
              Apr 24 '13 at 16:22











              0














              I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:



              <?php $referrer = $_SERVER['HTTP_REFERER'];
              if (preg_match("/great2gether.com/",$referrer) ) {
              define('WP_USE_THEMES', true);
              require( dirname( __FILE__ ) . '/wp-blog-header.php' );
              } else {
              header('Location: http://great2gether.com/splash.html');
              };
              ?>


              <?php


              Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.



              Hope this helps somebody :)






              share|improve this answer




























                0














                I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:



                <?php $referrer = $_SERVER['HTTP_REFERER'];
                if (preg_match("/great2gether.com/",$referrer) ) {
                define('WP_USE_THEMES', true);
                require( dirname( __FILE__ ) . '/wp-blog-header.php' );
                } else {
                header('Location: http://great2gether.com/splash.html');
                };
                ?>


                <?php


                Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.



                Hope this helps somebody :)






                share|improve this answer


























                  0












                  0








                  0







                  I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:



                  <?php $referrer = $_SERVER['HTTP_REFERER'];
                  if (preg_match("/great2gether.com/",$referrer) ) {
                  define('WP_USE_THEMES', true);
                  require( dirname( __FILE__ ) . '/wp-blog-header.php' );
                  } else {
                  header('Location: http://great2gether.com/splash.html');
                  };
                  ?>


                  <?php


                  Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.



                  Hope this helps somebody :)






                  share|improve this answer













                  I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:



                  <?php $referrer = $_SERVER['HTTP_REFERER'];
                  if (preg_match("/great2gether.com/",$referrer) ) {
                  define('WP_USE_THEMES', true);
                  require( dirname( __FILE__ ) . '/wp-blog-header.php' );
                  } else {
                  header('Location: http://great2gether.com/splash.html');
                  };
                  ?>


                  <?php


                  Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.



                  Hope this helps somebody :)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 20 '17 at 1:13









                  great2gether.comgreat2gether.com

                  14




                  14






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7658164%2fwordpress-splash-page-with-htaccess%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Full-time equivalent

                      Bicuculline

                      さくらももこ