Quick .htaccess redirect question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nexcom28
    So Fucking Banned
    • Jan 2005
    • 3716

    #1

    Quick .htaccess redirect question

    How do you redirect for example:

    domain.com/fat-boy/wicked

    to

    anotherurl.com/fat-boy-paradise

    Using .htaccess with the rediect happening after 10 seconds

    Thanks
  • paffie
    Confirmed User
    • Mar 2013
    • 116

    #2
    i don't think you have a delay-option in htaccess... I'm not a guru, but i've never heared from such a thing...

    Maybe you could use your html-headers for this:
    <meta http-equiv="refresh" content="10; url=http://example.com/">
    This way, you can show your original page, and it will automatically foreward after 10 seconds

    or place a code like this in your php-code:
    <?php
    sleep(10);
    header('Location: http://www.example.com/');
    ?>
    This second option (including in php) might need some tweaking, since it's possible the header has to be sent before any other data is sent to the browser... (actually, i'm pretty sure of this)
    Need a VPS? I use Ramnode, great uptime, friendly support and only $62/year (after their lifelong coupon) for an openVZ VPS => [email protected], 512Mb ram, 512 Mb swap, 120 Gb SSD, 1Gbps port, 2 Tb bandwith, 1 IPv4, 16 IPv6, weekly backups

    Comment

    • nexcom28
      So Fucking Banned
      • Jan 2005
      • 3716

      #3
      Yeah the problem is I just want to redirect selected pages of a wordpress blog to an external url.
      I did think about meta redirects but this would affect it sitewide wouldn't it.

      If I went down the .php could I just not call the php from anywhere within the page or does it need to be in the header.

      I'm sure there must be an easier way, a plugin or something.

      Comment

      • Barry-xlovecam
        It's 42
        • Jun 2010
        • 18083

        #4
        Code:
        Redirect permanent /path http://man-in-the-middle.com/meta-refresh-redirector-page.html?1
        man-in-the-middle.com/meta-refresh-redirector-page has the 10 seconds delay. (Or, use a JavaScript on the wordpress pages only redirecting for that referring page ...)

        https://www.google.com/search?client...+page+redirect
        Last edited by Barry-xlovecam; 08-21-2013, 12:22 PM.

        Comment

        • nexcom28
          So Fucking Banned
          • Jan 2005
          • 3716

          #5
          Thanks I found a plugin after all Quick Page/Post Redirect Plugin
          Seems to do the job.

          Comment

          • livexxx
            Confirmed User
            • May 2005
            • 1201

            #6
            You need instant 301's and work on the canonical redirects as well. Is it for google or surfers?
            http://www.webcamalerts.com for auto tweets for web cam operators

            Comment

            • AndrewX
              Confirmed User
              • Jan 2004
              • 574

              #7
              RewriteEngine on
              RedirectMatch /(.*)$ http://www.newdomain.com

              Just did this for a client.

              Edit: Oh I missed that 10 sec comment
              Last edited by AndrewX; 08-21-2013, 03:15 PM.

              █ ► XenLayer - Paravirtualization Professionals since 2008 - [ICQ: 297820698]
              █ ► Reseller Hosting | OpenVZ VPS | XEN VPS | Dedicated Servers

              Comment

              • lucas131
                ¯\_(ツ)_/¯
                • Aug 2004
                • 11475

                #8
                Originally posted by nexcom28
                Thanks I found a plugin after all Quick Page/Post Redirect Plugin
                Seems to do the job.
                yes happy you

                Comment

                • paffie
                  Confirmed User
                  • Mar 2013
                  • 116

                  #9
                  Originally posted by nexcom28
                  If I went down the .php could I just not call the php from anywhere within the page or does it need to be in the header.
                  I'm happy the plugin works for you :-)
                  In case anybody ever finds this post, and wants to use php instead of a plugin, the anser to your question is: the header location has to be set before any other data is sent to the users browser (if i remember correctly)...
                  In other words, you can actually make a database-query, use classes and functions,... and depending on the outcome of your querys and calculations print the "header('location" or not. As long as nothing is sent to the browser during the execution of your code.... So it wouldn't be wise to use this line in the <body>-section ;-)
                  Last edited by paffie; 08-22-2013, 12:13 AM.
                  Need a VPS? I use Ramnode, great uptime, friendly support and only $62/year (after their lifelong coupon) for an openVZ VPS => [email protected], 512Mb ram, 512 Mb swap, 120 Gb SSD, 1Gbps port, 2 Tb bandwith, 1 IPv4, 16 IPv6, weekly backups

                  Comment

                  • HomerSimpson
                    Too lazy to set a custom title
                    • Sep 2005
                    • 13826

                    #10
                    Originally posted by AndrewX
                    RewriteEngine on
                    RedirectMatch /(.*)$ http://www.newdomain.com

                    Just did this for a client.

                    Edit: Oh I missed that 10 sec comment
                    don't forget to add [r=301]
                    Make a bank with Chaturbate - the best selling webcam program
                    Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

                    PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:

                    Comment

                    Working...