Results 1 to 6 of 6
  1. #1

    How to add a global "redirect" to site?

    I have a site and would like to setup a automatic custom link type of thing. What I am refering to is what I've seen on numerous sites such as

    http://www.mysite.com/blah/redirect.php?

    So if someone entered http://www.store.com it would turn it into http://www.mysite.com/blah/redirect..../www.store.com on my site, with the final result being a customized affiliate link?

  2. #2
    Join Date
    Dec 2002
    Location
    The Shadows
    Posts
    2,925
    Should be fairly easy to do. If you feel like monkeying yourself, check out apache.org's info on mod_rewrite.

    Otherwise, I will let someone else post, since I need sleep... I have two exams tomorrow
    Dan Sheppard ~ Freelance whatever

  3. #3
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,104
    Try this
    Code:
    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule (*.?) http://www.foo.com/redirect?site=$1 [L, QSA]
    </IfModule>
    Not sure if it will work

  4. #4
    While I appreciate your responses, fyrestrtr. I dont understand what your saying. I know how and can add it to the right spot but after that im still stumped.

  5. #5
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,104
    Well firstly, I goofed on it.
    Its supposed to be ^(.*?)$ not (*.?)

    Anyhow, here is what it does.

    It takes any request, and passes it as an argument to your redirect script.

    So, if someone enters (in their browser)

    http://www.site.com/

    mod_rewrite will actually send it to

    http://www.foo.com/redirect?site=http://www.site.com/

    You have to write the redirect script (foo.com/redirect), of course.

    Hopefully this makes it a bit clear. You may also want to look over the URL Rewriting Guide over at apache.org

  6. #6
    Much clearer

    Thanks a bunch!

Posting Permissions

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