Creating 4 Redirect URLs, (using Htaccess) ?

by entry
11 replies
Thanks.

I have 4 affiliate links which I need redirecting from 4 Seperate URLS.

So here are the 4 Redirect pages (I am having difficulty producing)
www.MyDomain.com/Suprise1
www.MyDomain.com/Suprise2
www.MyDomain.com/Suprise3
www.MyDomain.com/Suprise4

The above 4 will be redirected to the above ones
www.AffiliateProduct1.com
www.AffiliateProduct2.com
www.AffiliateProduct3.com
www.AffiliateProduct4.com

the basic concept is this:

www.MyDomain.com/Suprise1 -> www.AffiliateProduct1.com (redirected after 0 seconds)

www.MyDomain.com/Suprise2 -> www.AffiliateProduct2.com (redirected after 0 seconds)


So i need to set this up 4 times. using the QUICK method which you have said is the Htaccess file version?

(in my other question here - http://www.warriorforum.com/programm...ml#post2618899 )
#creating #htaccess #redirect #urls
  • Profile picture of the author SteveJohnson
    Code:
    Redirect 302 /Surprise1 http://www.AffiliateProduct1.com
    Redirect 302 /Surprise2 http://www.AffiliateProduct2.com
    Redirect 302 /Surprise3 http://www.AffiliateProduct3.com
    Redirect 302 /Surprise4 http://www.AffiliateProduct4.com
    Substitute your own URLs in the above. Place the .htaccess file in the webroot directory of mydomain.com.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2641170].message }}
    • Profile picture of the author entry
      Thanks.

      Can you give some more detail on it please, i am still a bit confused. Can you give it in a bit more detail please.
      Signature
      I Have to say a Massive...THANK YOU to every Warrior who has helped me, and thanks to every warrior who helps me in the future...
      {{ DiscussionBoard.errors[2643563].message }}
  • Profile picture of the author cyphix
    It's pretty simple..... in "SteveJohnson's" example it will redirect the file "/Surprise1" (ie; mydomain.com/Surprise1") to "AffiliateProduct1.com" & so on..

    The 302 just means it's a temporary redirect & not a permanent one.
    {{ DiscussionBoard.errors[2645074].message }}
    • Profile picture of the author entry
      Originally Posted by cyphix View Post

      It's pretty simple..... in "SteveJohnson's" example it will redirect the file "/Surprise1" (ie; mydomain.com/Surprise1") to "AffiliateProduct1.com" & so on..

      The 302 just means it's a temporary redirect & not a permanent one.
      a) Temporary Not Permanant?...why is it good to be temporary and not permanent?

      b) or what is the disadvantage of it being temporary?


      c) Is Steves method (the above 302 .htaccess one reliable for 3-4 years (it is for an AR series)..... which is why i am asking for permanant VS Temporary.

      d) and am i inserting that code in the .htaccess

      e) Is it .htaccess. or .htaccess.txt or .htaccess.htm ?
      Signature
      I Have to say a Massive...THANK YOU to every Warrior who has helped me, and thanks to every warrior who helps me in the future...
      {{ DiscussionBoard.errors[2647015].message }}
  • Profile picture of the author SEOTranslator
    Temporary vs permanent is up to you. Use permanent if you think that the links will never change. I prefer temporary because I might drop the affiliate at a certain moment, and also because a 301 (permanent) redirect passes link juice to the target (unless you use a nofollow link to your /Surprise pages (which is highly recommended).

    For a permanent redirect, use 301 instead of 302 in Steve's script.

    The .htaccess is a simple text file, but you need to leave the name just like that. I.e., .htaccess, NOT .htaccess.txt or .htaccess.htm
    Signature
    Website localization and multilingual SEO
    Making your translated sites friendly for humans and machines alike.
    {{ DiscussionBoard.errors[2647187].message }}
  • Profile picture of the author SteveJohnson
    I use 302 redirects on aff links because I want the visitor's browser checking every time. If you use a 301 (which is totally fine, if you're sure the target destination will never change), the browser knows it has been redirected permanantly and caches the result, never to check again until its cache expires.

    Or at least that's the theory.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2649407].message }}
  • Profile picture of the author cyphix
    I'm pretty sure they don't have to exist... as the server will just redirect anyone going to that URL to the new URL; don't think it bothers to check if it exists.

    Though if you have 404 redirection code in there too, not sure how friendly it plays with that.... probably best to just create blank files.
    {{ DiscussionBoard.errors[2649919].message }}
  • Profile picture of the author SteveJohnson
    No need to create files, they do NOT have to exist. Your server looks at the .htaccess file for the folder before it looks for and attempts to load a file.

    The only time a 404 is sent by the server is when it attempts to load a file that isn't there. In your case, it's not even getting to that stage.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2650137].message }}
    • Profile picture of the author entry
      Originally Posted by SteveJohnson View Post

      No need to create files, they do NOT have to exist. Your server looks at the .htaccess file for the folder before it looks for and attempts to load a file.

      The only time a 404 is sent by the server is when it attempts to load a file that isn't there. In your case, it's not even getting to that stage.
      So it redirects without creating the files?

      could that ever cause an error? or it should be fine?

      (couldi be extra safe and include the files,
      as Surprise1/index.htm )

      so if it is ever needed by the email subscribers, they can find it?
      Signature
      I Have to say a Massive...THANK YOU to every Warrior who has helped me, and thanks to every warrior who helps me in the future...
      {{ DiscussionBoard.errors[2650297].message }}
      • Profile picture of the author SteveJohnson
        Originally Posted by entry View Post

        So it redirects without creating the files?

        could that ever cause an error? or it should be fine?

        (couldi be extra safe and include the files, as Surprise1/index.htm ) so if it is ever needed by the email subscribers, they can find it?
        Yes, it redirects without creating files. No, it will never cause an error. As I said, the server loads and executes the .htaccess file before it even goes looking for the requested file.

        You can, of course, do whatever you want in creating files. It's just a waste of your time. If you do the redirect properly, the file will never ever get served to a browser. Never.

        When you look at a WordPress blog, not a single page that you view exists on the server. It's all done with redirects (actually rewrites, but the same concept).
        Signature

        The 2nd Amendment, 1789 - The Original Homeland Security.

        Gun control means never having to say, "I missed you."

        {{ DiscussionBoard.errors[2650627].message }}

Trending Topics