LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2019, 04:53 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
No Referer in .htaccess


Hi
I have a wordpress site, I cant see the referer in .htaccess. No matter what I do it wont show , it is always empty. I.e. visit from Google, or visit from another site, or going from link to link in the same site.

PHP does work, as it shows

[HTTP_REFERER] => http://abc.om

But there is not trace of the referer in any RewriteRule or RewriteCond I try

#RewriteCond %{HTTP_REFERER} !(.+)
#RewriteRule ^(.*) - [CO=emptyRef:%{HTTP_REFERER}:.abc.com/]

Or

RewriteEngine on
RewriteCond %{HTTP_REFERER} (.*)://(.*)/
RewriteRule ^(.*) - [CO=FullRef:$2:.abc.com/]



Any advice pease ?
 
Old 08-28-2019, 12:59 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
RewriteEngine on
RewriteCond %{HTTP_REFERER} (.*)://(.*)/
RewriteRule ^(.*) - [CO=FullRef:$2:.abc.com/]



Any advice pease ?
You need to use %2 instead of $2 in the RewriteRule above.

And you should have posted that in your other thread, instead of opening a new one


Regards
 
Old 08-30-2019, 03:56 AM   #3
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
Hi , thank you for your help.

I still have an issue with this. See the below works, a cookie is created called emptyRef and the value is set to the hostname, abc.com in this example.

RewriteRule (.*) - [CO=emptyRef:%{HTTP_HOST}:.abc.com]

However when using the below the cookie is not even created, I cant put my finger on it, but %{HTTP_REFERER} does not seem to work. I did check if this might be a typo and it is not. It is as if the variable does not exist. Is this some sort of Apache misconfiguration issue ? Thanks

RewriteRule (.*) - [CO=emptyRef5:%{HTTP_REFERER}:.abc.com]
 
Old 08-30-2019, 04:43 AM   #4
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Perhaps better to put this thread in the server section:
https://www.linuxquestions.org/quest...nux-server-73/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess referer restrictions mlapl1 Linux - Security 2 09-01-2007 08:29 AM
.htaccess referer problem mlapl1 Linux - Newbie 0 08-30-2007 04:17 PM
selective referer blocking feature? jiml8 General 2 01-14-2007 01:05 PM
Referer HTTP Headers and Squid win32sux Linux - Networking 0 09-17-2005 03:02 PM
cannot determine conf location from referer safescott Linux - General 1 06-12-2004 11:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration