Rewrite based on http referer and rewritemap
26 posts
• Page 2 of 2 • 1, 2
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite based on http referer and rewritemap
It does repeat three times, but you provided only the first one, while your testing request was supposed to be captured by the third rule?
By the way, do other domains work for other 2 rules? like domain.com and domain.com.uk?
Regards
Andrew
By the way, do other domains work for other 2 rules? like domain.com and domain.com.uk?
Regards
Andrew
Re: Rewrite based on http referer and rewritemap
Hi Andrew
None of the domains seem to work for me using a referrer spoof. Here's the full log:
Any thoughts?
None of the domains seem to work for me using a referrer spoof. Here's the full log:
- Code: Select all
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (2) init rewrite engine with requested uri /test_page.aspx
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (1) Htaccess process request e:\www.site.org.uk\.htaccess
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (3) applying pattern '^test_page\.aspx' to uri 'test_page.aspx'
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='http://subdomain1.toplevel1.org.uk/test.html' pattern='http://(?:www\.)?([^.]+\.[^.]+).*' => matched
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (5) map lookup FAILED: map=mapfile[txt] key=subdomain1.toplevel1
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='NOT_FOUND' pattern='!NOT_FOUND' => not-matched
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (3) applying pattern '^test_page\.aspx' to uri 'test_page.aspx'
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='http://subdomain1.toplevel1.org.uk/test.html' pattern='http://(?:www\.)?([^.]+\.[^.]+\.[^.]+).*' => matched
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (5) map lookup FAILED: map=mapfile[txt] key=subdomain1.toplevel1.org
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='NOT_FOUND' pattern='!NOT_FOUND' => not-matched
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (3) applying pattern '^test_page\.aspx' to uri 'test_page.aspx'
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='http://subdomain1.toplevel1.org.uk/test.html' pattern='http://(?:www\.)?([^.]+\.[^.]+\.[^.]+\.[^.]+).*' => matched
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (5) map lookup FAILED: map=mapfile[txt] key=subdomain1.toplevel1.org.uk/test
Wed, 27-Mar-2013 15:02:04 GMT [subdomain.toplevel.org.uk/sid#1863113428][rid#20259936/initial] (4) RewriteCond: input='NOT_FOUND' pattern='!NOT_FOUND' => not-matched
Any thoughts?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite based on http referer and rewritemap
You see, there're three attempts to search for a key.
For some reason, the third rule includes /test in it, that's the reason it fails. Please, double-check the third rule.
Regards
Andrew
For some reason, the third rule includes /test in it, that's the reason it fails. Please, double-check the third rule.
key=subdomain1.toplevel1
key=subdomain1.toplevel1.org
key=subdomain1.toplevel1.org.uk/test
Regards
Andrew
Re: Rewrite based on http referer and rewritemap
Hi Andrew
I believe that the /test is appearing because the page that the referrer link is http://subdomain1.toplevel1.org.uk/test.html
The rules I have are exactly as you mentioned:
I believe that the /test is appearing because the page that the referrer link is http://subdomain1.toplevel1.org.uk/test.html
The rules I have are exactly as you mentioned:
- Code: Select all
RewriteCond %{HTTP_REFERER} http://(?:www\.)?([^.]+\.[^.]+).* [NC]
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^test_page\.aspx http://www.test.org.uk [NC,R=301,L]
RewriteCond %{HTTP_REFERER} http://(?:www\.)?([^.]+\.[^.]+\.[^.]+).* [NC]
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^test_page\.aspx http://www.test.org.uk [NC,R=301,L]
RewriteCond %{HTTP_REFERER} http://(?:www\.)?([^.]+\.[^.]+\.[^.]+\.[^.]+).* [NC]
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^test_page\.aspx http://www.test.org.uk [NC,R=301,L]
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite based on http referer and rewritemap
Not sure I understand:
"I believe that the /test is appearing because the page that the referrer link is http://subdomain1.toplevel1.org.uk/test.html"
Lets try to replace
with
Regards
Andrew
"I believe that the /test is appearing because the page that the referrer link is http://subdomain1.toplevel1.org.uk/test.html"
Lets try to replace
- Code: Select all
RewriteCond %{HTTP_REFERER} http://(?:www\.)?([^.]+\.[^.]+\.[^.]+\.[^.]+).* [NC]
with
- Code: Select all
RewriteCond %{HTTP_REFERER} http://(?:www\.)?([^./]+\.[^./]+\.[^./]+\.[^./]+).* [NC]
Regards
Andrew
Re: Rewrite based on http referer and rewritemap
Thanks for your help Andrew. This worked and the rewrite based on referrer is now in place.
I hope others might find this thread useful.
I hope others might find this thread useful.
26 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 17 guests