You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nelson Goforth <ng...@earthnet.net> on 2003/01/25 17:18:05 UTC

[users@httpd] Rewrite - difficulty with substitution

The id numbers I'm using in an online database have changed, and so I'm 
trying to force the search engines to update their links to internal 
pages.

I want to force Referers others than my own site to go to the index 
page, rather than to the perl script that drives the system.

I've ALMOST got it working with:

	RewriteCond %{HTTP_REFERER} !^http://www.myserver.*
	RewriteRule ^cgi-bin/(.+)$ http://www.myserver.com/index.html [L,R=301]

However, assuming the link was to 
".../cgi-bin/lookup.pl?searchkeys=3456",  the URL is being rewritten as:

        http://www.myserver.com/index.html?searchkeys=3456

Which I don't want - just "index.html", please!

I don't know why the substitution is being performed.  Before I put the 
(.+) memory in place in the Rule the entire request was being added on 
(like ...myserver.com/index.htmllookup.pl?...etc.) and would get a 404 
error or worse.  So I tried to capture EVERYTHING after the /cgi-bin 
and then just NOT use it.

Any ideas what I'm doing wrong?

Thank you,
Nelson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Rewrite based upon Referer?

Posted by Nelson Goforth <ng...@earthnet.net>.
I asked this once before with no replies, but I still haven't figured 
it out, so I'll try again.

I want to force Referers others than my own site to go to the index 
page, rather than to the perl script that drives the system.

I've looked at the incoming Referer string and it begins: 
"http://www.google.com/search?..."

I've tried a number of variations including:

	RewriteCond %{HTTP_REFERER} !^http://www.myserver.*
	RewriteRule ^cgi-bin/(.+)$ http://www.myserver.com/index.html [L,R=301]

But it just ignores me.  I know the Rewrite Engine is on, because I'm 
doing a couple of other Rewrites on other topics.  However, I need to 
put this one FIRST because Google continues to point to the old search 
method (which returns a page).  I want to force any search engines to 
use the new method, which means forcing them, temporarily, to go to the 
index page.

Any ideas what I'm doing wrong?

Thank you,
Nelson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite based upon Referer?

Posted by Nelson Goforth <ng...@earthnet.net>.
I asked this once before with no replies, but I still haven't figured 
it out, so I'll try again.

I want to force Referers others than my own site to go to the index 
page, rather than to the perl script that drives the system.

I've looked at the incoming Referer string and it begins: 
"http://www.google.com/search?..."

I've tried a number of variations including:

	RewriteCond %{HTTP_REFERER} !^http://www.myserver.*
	RewriteRule ^cgi-bin/(.+)$ http://www.myserver.com/index.html [L,R=301]

But it just ignores me.  I know the Rewrite Engine is on, because I'm 
doing a couple of other Rewrites on other topics.  However, I need to 
put this one FIRST because Google continues to point to the old search 
method (which returns a page).  I want to force any search engines to 
use the new method, which means forcing them, temporarily, to go to the 
index page.

Any ideas what I'm doing wrong?

Thank you,
Nelson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org