+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Can i redirect pages automatically?

  1. #1
    tlife143's Avatar
    tlife143 is offline x10Hosting Member tlife143 is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    2

    Can i redirect pages automatically?

    I WANT TO REDIRECT WEB PAGES AUTOMATICALLY!!! CAN I DO???

    I USED THIS CODE TO REDIRECT
    <?PHP
    header('Location: http://redirectpage.html')
    ?>

    but it is displaying an error message as

    Warning: Cannot modify header information - headers already sent


    plz help me out!!!

  2. #2
    f1lt3rh34d is offline x10Hosting Member f1lt3rh34d is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    BelGium
    Posts
    30

    Re: Can i redirect pages automatically?

    that's because you already sent data to the browser.

    There's also an alternative which doesn't require PHP.

    Code:
    <?php
    echo '<meta http-equiv=refresh content="1; url=http://redirectpage.html">';
    ?>
    The 1 is the delay; currently 1 second. You can also set it to 0.
    url is the location where it should redirect to.

  3. #3
    zxeveroxz is offline x10Hosting Member zxeveroxz is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Peru
    Posts
    6

    Arrow Re: Can i redirect pages automatically?

    :lockd::lockd:

    Ayuden pero en español

  4. #4
    nirajkum is offline x10 Sophmore nirajkum is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    161

    Re: Can i redirect pages automatically?

    use url_redirect .. It will redirect your page

  5. #5
    espfutbol98's Avatar
    espfutbol98 is offline x10 Sophmore espfutbol98 is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Zagreb... želim
    Posts
    200

    Re: Can i redirect pages automatically?

    Quote Originally Posted by zxeveroxz View Post
    Ayuden pero en español
    ¿Puede ayudarlo soló en español o necesita ayuda en español?
    Estoy aprendiendo español y pienso, si necesita, puedo ayudarse.
    :dunno:
    Last edited by espfutbol98; 06-25-2009 at 01:42 PM.

  6. #6
    unbenicio's Avatar
    unbenicio is offline x10Hosting Member unbenicio is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    15

    Re: Can i redirect pages automatically?

    you guys just gave me an idea thanks..:hahano:

  7. #7
    farscapeone's Avatar
    farscapeone is offline Community Advocate farscapeone is on a distinguished road
    Join Date
    Dec 2008
    Location
    Србија (Serbia)
    Posts
    1,166

    Re: Can i redirect pages automatically?

    If you want to use PHP header to do this try reading this article: http://php.about.com/od/learnphp/ht/phpredirection.htm

    Or if you don't care if it's PHP or not simply use JavaScript like this:
    Code:
    location.href = "any_page.html";

  8. #8
    lhyman's Avatar
    lhyman is offline x10 Sophmore lhyman is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    198

    Smile Re: Can i redirect pages automatically?

    Quote Originally Posted by f1lt3rh34d View Post
    that's because you already sent data to the browser.

    There's also an alternative which doesn't require PHP.

    Code:
    <?php
    echo '<meta http-equiv=refresh content="1; url=http://redirectpage.html">';
    ?>
    The 1 is the delay; currently 1 second. You can also set it to 0.
    url is the location where it should redirect to.
    Thanks, that one worked for me !

  9. #9
    subsilver is offline x10Hosting Member subsilver is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    5

    Re: Can i redirect pages automatically?

    There is also one method which can be used if the website is hosted on apache webserver (x10hosting uses apache). Edit .htaccess file in your site root directory, and add following line:
    Code:
    Redirect 301 /oldpage.html http://www.example.com/newpage.html
    Cheers!

  10. #10
    marshian's Avatar
    marshian is offline x10 Elder marshian is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Belgium
    Posts
    526

    Re: Can i redirect pages automatically?

    Just use headers the way they're supposed to be used, before any other output.
    PHP Code:
    <?PHP
    header
    ('Location: http://redirectpage.html')
    ?>
    Will work perfectly, if you make sure there is NO OUTPUT BEFORE THE HEADER. A newline character or space before the <?php does count as output too.
    Real programmers don't document their code - if it was hard to write, it should be hard to understand.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Sub-domain cannot redirect to index.php automatically
    By narongsak in forum Free Hosting
    Replies: 1
    Last Post: 02-21-2009, 12:18 PM
  2. Replies: 4
    Last Post: 07-13-2008, 07:03 AM
  3. Redirect
    By BlueIce in forum Free Hosting
    Replies: 3
    Last Post: 10-21-2007, 08:06 AM
  4. help-add content to all pages at once
    By andhrafun in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 09-19-2007, 03:41 AM
  5. Replies: 7
    Last Post: 09-16-2005, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers