How to make a url redirect with a cookie? (.haccess maybe?)

Discussion in 'Site & Server Administration' started by Lorelei, Aug 20, 2009.

  1. #1
    Hi,

    I have a problem and I have spent the whole morning trying to solve it, but in vain.

    I need to redirect my wordpress demos to another domain. I tried the usual redirect option in cPanel but it won't work for a cookie url. Basically, I need to

    http://impulseblogger.com/demo/index.php?wptheme=Magawin

    redirect to

    http://wpthemes.toptut.com/index.php?wptheme=Magawin

    It must have the cookie (and not just http://impulseblogger.com/demo/index.php, like it happened in cP) otherwise there is no point in a demo.

    I use a dedicated server so I have full access to all the functions, if I need them to. My guess is that there should be a .haccess trick, but no idea how to do it and where to start. I will be so grateful if anyone would help!

    Thanks,
    Liza
     
    Lorelei, Aug 20, 2009 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not sure if mod_rewrite is able to carry cookies from one page to another, especially not across to a different domain. In fact I don't think you mean 'cookie', you must mean 'query string'. for example, "?wptheme=Magawin".

    well, to carry those across domains or wherever you want to go, you need [QSA], which means 'query string append'. So:

    RewriteRule ^http://impulseblogger.com/demo/index.php$ http://wpthemes.toptut.com/index.php [QSA,L]
    Code (markup):
    would probably be one way to go, but as I can never get these things right without testing, go ahead and try yourself! :p

    If it doesn't work try:

    RewriteRule ^http://impulseblogger.com/demo/index.php?wptheme=(.*)$ http://wpthemes.toptut.com/index.php?wptheme=$1 [QSA,L]
    Code (markup):
    .
     
    szalinski, Aug 21, 2009 IP
  3. bulkemailpp

    bulkemailpp Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use [R=301,QSA,L] in the brackets.
     
    bulkemailpp, Aug 24, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you tell me why a cookie is needed? Cookies don't transfer over to other domains, that is a protection. Imagine if another site was able to read google.com or amazon.com cookies..

    Why don't your sites work without these cookies?

    There are a couple of hacks to accomplish this, but I would like an answer to this question first.


    Basically on site A you'll need to
     
    premiumscripts, Aug 24, 2009 IP