Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2013
    Posts
    35

    Problem with htaccess

    Hi guys ,
    I'm running a wordpress website . I use two index files . one is index.html and the other is index.php . As you know when there are two index files , if you open your site.com , by default index.html loads . I want to redirect index.html to index.php after it loaded . I mean I want index.html to load first and then redirects to index.php . how can I do this ?

  2. #2
    Join Date
    Jul 2014
    Location
    Malaysia
    Posts
    62
    Quote Originally Posted by mastermovie View Post
    Hi guys ,
    I'm running a wordpress website . I use two index files . one is index.html and the other is index.php . As you know when there are two index files , if you open your site.com , by default index.html loads . I want to redirect index.html to index.php after it loaded . I mean I want index.html to load first and then redirects to index.php . how can I do this ?
    Code:
    cPanel > Domains > Redirects

  3. #3
    Join Date
    Oct 2013
    Posts
    35
    thanks for the answer , but it does not work . It stays on index.html and doesn't redirect to index.php

  4. #4
    Join Date
    Jul 2014
    Location
    Malaysia
    Posts
    62
    Quote Originally Posted by mastermovie View Post
    thanks for the answer , but it does not work . It stays on index.html and doesn't redirect to index.php
    It isn't possible, exactly how would you expect this to work?
    How can a single browser window go to two pages at the same time?

  5. #5
    Join Date
    Oct 2013
    Posts
    35
    3.pfilm14.ir open this site . it opens an html page that says loading... and after that it moves to the real wordpress site . I want the same

  6. #6
    Join Date
    Jul 2014
    Location
    Malaysia
    Posts
    62
    You can try something like this:
    Code:
    <head>
    ...
    <script type="text/javascript">
        if (document.documentElement) {
            document.documentElement.className = 'loading';
        }
    </script>
    ...
    </head>
    Stick that in your <head> tag, then add some CSS to hide everything on the page except for your loading animation. For example:

    Code:
    .loading > body > * {
        display:none;
    }
    .loading body {
        background:#fff url(../images/loading.gif) no-repeat 50% 50%;
    }
    Then add some JavaScript to clear the html tag's class name when the page has finished loading:

    Code:
    // Using jQuery
    $(document).ready(function() {
        ...
        $(document.documentElement).removeClass('loading');
        ...
    });
    Hope this helps. /Source from oxley.

  7. #7
    Join Date
    Oct 2013
    Posts
    35
    Thank you I will try them , let you know if they worked

  8. #8
    Rather than using .htaccess you could use a meta refresh to instantly redirect the browser. This way index.html could be loaded and then redirected immediately to index.php.

    Add something like this to the <head> section of index.html:

    Code:
    <meta http-equiv="refresh" content="0;URL='http://www.example.com/index.php'" />

  9. #9
    Use the below code in .htaccess so that index.html loads first
    Code:
    DirectoryIndex index.html index.php
    Once you are in index.html, there are many ways to redirect to index.php. Once method will be using javascipt to redirect. you can use 'window.location' to accomplish this.

    Cheers!

  10. #10
    Join Date
    Jan 2013
    Posts
    66
    I'm not really sure why you would want to delay loading your index.php file by going to an index.html splash page with auto redirect to the index.php, but you may have your reason.

    You can do the meta redirect in the index.html page and have it show your loading text or icon on a delay, say 5 seconds.

    Code:
    <META HTTP-EQUIV="refresh" CONTENT="5;URL=the-other-page.html">
    Or, if you simply want the index.php to display before the index.html, then set the following code in your .htaccess file:

    Code:
    DirectoryIndex index.php index.html
    This makes the webserver look for the index.php file first, and then index.html if it the php file is not present.

  11. #11
    Join Date
    Jul 2009
    Location
    Los Angeles, California
    Posts
    9
    use the meta refresh as indicated above, but it would help if you said why you want this to happen?

  12. #12
    Why don't you just delete the index.html reference if your ultimate goal is to load the index.php file? From my standpoint, I don't see why you want to load the index.html if it isn't where you want the browser to end up.
    EmailHosting.com
    http://www.emailhosting.com

  13. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Similar Threads

  1. .htaccess problem
    By juventus in forum Hosting Security and Technology
    Replies: 2
    Last Post: 03-20-2012, 08:04 AM
  2. .htaccess Problem?
    By jisaiah14 in forum Web Design and Content
    Replies: 2
    Last Post: 01-12-2012, 12:32 AM
  3. htaccess problem
    By danyboy2010 in forum Programming Discussion
    Replies: 2
    Last Post: 02-05-2007, 02:31 PM
  4. htaccess problem
    By Sillysoft in forum Hosting Security and Technology
    Replies: 2
    Last Post: 03-06-2005, 03:55 AM
  5. .htaccess problem
    By croakingtoad in forum Programming Discussion
    Replies: 11
    Last Post: 04-05-2003, 10:02 PM

Related Posts from theWHIR.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •