Apache mod_rewrite url question

by johlum
4 replies
Is it possible to do this using the mod_rewite capability.

Anytime any application on my server wants to send a visitor to a url say:

http://www.theirdomain.com

I force it to go to

http://www.theirdomain.com/12345/tips

or

http://www.theirdomain.com/index.php?abcdefg12345

And if so, would it look something like this:

RewriteCond %{HTTP_HOST} !^www.theirdomain.com
RewriteRule ^/(.*) http://www.theirdomain.com/12345/tips

thanks

Ernie
#apache #modrewrite #question #url
  • Profile picture of the author zortag
    Can you change the destination URL in the application on your server?

    Or do you own the destination URL? I think one of these is required to make it work.

    If you can target a file on your own server then you can also do this in PHP:

    targetfile.php on your server contains:

    <?php
    header('Location: http://www.theirdomain.com/12345/tips');
    ?>
    Signature

    Get US Facebook Fans for your fan page
    Get Unlimited Relevant Backlinks with Neurolinker.com

    {{ DiscussionBoard.errors[99265].message }}
  • Profile picture of the author johlum
    Jeff,

    I had just posted this when I thought, " I should just ping Jeff and ask him, I bet he knows how."

    Too funny.

    I don't own the url, it's an affiliate link.

    Here's why I asked.

    I'm using OpenX on our VPS and for some reason it strips off the number 12345 (www.domain.com/12345/tips) when the ad is clicked on and sends the visitor to
    www.domain.com/tips.

    The ad is served via javascript to another domain on our VPS, but not the domain OpenX resides on.

    No word from anyone on their forum as to why or how to fix it so I thought the rewrite in Apache might work - for the time being.

    I want to force those clicks to go to www.domain.com/12345/tips

    Ernie
    {{ DiscussionBoard.errors[99281].message }}

Trending Topics