Apache mod_rewrite url question

by 4 comments
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:


I force it to go to




And if so, would it look something like this:

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


#internet marketing #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:

    header('Location: http://www.theirdomain.com/12345/tips');
  • Profile picture of the author johlum

    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

    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


Next Topics on Trending Feed