mod_rewrite problem

Discussions about Apache mod Rewrite, .htaccess, Use, experiences ... URL Rewriting.

Moderator: Moderators

mod_rewrite problem

Postby neyne » Sat Nov 24, 2007 10:26 am

Hi everyone,

I'm ahving a problem with a rewrite I want to do. Basically, I want to redirect traffic from a certain site to a specific page on my site. I won't see hwo this would be any different than redirecting to a customized homepage according to the user agent (except for the RewriteCond, but it doesn't work.

This is the code:

Code: Select all
RewriteEngine on
#Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_REFERER} ^http://www.originating-site\.com [NC]
RewriteRule ^.*$ /target-page-on-my-site.html [R]
neyne
 
Posts: 1
Joined: Sat Nov 24, 2007 10:21 am

Advertisement

Re: mod_rewrite problem

Postby SeO » Sat Nov 24, 2007 12:58 pm

What do you want to do more precisely ?
You say you want to redirect traffic from a site, thus from a domain?, but instead, you talk of user agent and in the end start trying with the HTTP_referrer. So it's a bit confusing.

If the domain you want to redirect from is yours, you'd better redirect from where it is installed than playing with HTTP_REFERER, because the referrer value can be empty or wrong, due to firewalls or user manipulation in the browser.
Doing it with the HTTP_REFERER implies you take car of the empty referrer case, something like :

Code: Select all
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^http://www\.referaldomain\.com$ [NC]
ReWriteRule ^.*$ /target-page-on-my-site.html [L,R=301]
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm


Return to Apache mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests