D
D
Denis2014-02-10 11:30:45
Apache HTTP Server
Denis, 2014-02-10 11:30:45

How to set up redirects with saving the referrer?

Good afternoon!
How can I set up a redirect with .htaccess to save the referrer?
I write like this:

RewriteRule ^(.*)$ http://sitename.ru/$1?from=%{HTTP_REFERER} [L,R=301]

Doesn't work (empty string).
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2014-02-10
@newpdv

If I click on page A to go to page B, and page B issues a 302 redirect to page C, then page C will still have a referrer from page A.

A
akashtrih, 2014-02-10
@akashtrih

Somehow it has to be.

RewriteCond %{HTTP_REFERER} ^(.*)$
RewriteRule ^(.*)$ http://sitename.ru/$1?from=%1 [L,R=301]

Well, an article, just in case: habrahabr.ru/company/sprinthost/blog/129560

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question