Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Trying to build a similar request than A9's. - rewrite new..

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
Is there a GUI configuration tool similar to the one for I.. - I've recently begun trying to myself, and one of the key things I need in order to break my MSFT habit is a good set of tools for my web work. What I'm looking for is a tool for Apache that will allow me..

2.0.48 and RPM build - PGP SIGNED Hash: SHA1 hi, i've got this params: \ \ \ \ ..

Build for win32 without VC++? - I had posted this on but see that this group has more traffic. Has anybody ever tried (not to mention to build a version of Apache for Win32 version 2) using FOSS tools and..

Apache 2.0.47 build on RH9 - make looks good until: -lrt -lm - lcrypt -lnsl -ldl gcc: No such file or directory gcc:..

Apache 2.0 doesn't build on Mac OS X 10.3 (Panther) - I've been to build Apache 2.0.48 on MacOS X version 10.3 on a G4 (iBook). This built fine on 10.2, but since the upgrade to Panther, I'm running into build problems in the poll/unix I suspect it has something to do with..
Author Message
stromboli2

External


Since: Oct 07, 2004
Posts: 4



(Msg. 1) Posted: Thu Oct 07, 2004 2:57 pm
Post subject: Trying to build a similar request than A9's. - rewrite newbie
Archived from groups: alt>apache>configuration (more info?)

Hi,
I'm pretty newbie on rewrite. I'd like to do make my machine serves
the search requests in the same way that A9.com does, this is:
http://a9.com/emilie%20simon performs a search for emilie simon in
a9
Mine search script is located in
http://myserver.com/search.cgi?query=emilie%20simon&moretermshere

<Directory "/var/www/myserver">
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^(.*)$ /search\.cgi?query=$1 [PT]
</Directory>
Well I wrote this but is not working.

I have several subdirectories like sub1.myserver.com --
myserver.com/sub1, sub2.myserver.com -- myserver.com/sub2 etc.
What about if the search phrase is the same than the name of the
subdirectory?
thank u very much for reading! Smile,

Stromboli

 >> Stay informed about: Trying to build a similar request than A9's. - rewrite new.. 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 2) Posted: Fri Oct 08, 2004 2:12 am
Post subject: Re: Trying to build a similar request than A9's. - rewrite newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Stromboli" <stromboli2.RemoveThis@hotpop.com> schreef in bericht
news:7096359e.0410071057.14dd5c1d@posting.google.com...
 > Hi,
 > I'm pretty newbie on rewrite. I'd like to do make my machine serves
 > the search requests in the same way that A9.com does, this is:
 > <a style='text-decoration: underline;' href="http://a9.com/emilie%20simon" target="_blank">http://a9.com/emilie%20simon</a> performs a search for emilie simon in
 > a9
 > Mine search script is located in
<font color=purple> > <a style='text-decoration: underline;' href="http://myserver.com/search.cgi?query=emilie%20simon&moretermshere</font" target="_blank">http://myserver.com/search.cgi?query=emilie%20simon&moretermshere</font</a>>
 >
 > <Directory "/var/www/myserver">
 > RewriteEngine on
 > Options +FollowSymlinks
 > RewriteRule ^(.*)$ /search\.cgi?query=$1 [PT]
 > </Directory>
 > Well I wrote this but is not working.
Why putting it in a directory context?
I'ld prefer server or virtual host.

The %20 represent a space; however the RewriteRules sees the space not the
%20.
RewriteMap decode int:escape
RewriteRule (.*) /search\.cgi?query=${decode:$1} [QSA]

Don't think you need the PTflag and added QSA to allow
<a style='text-decoration: underline;' href="http://host/emilie%20simon?tst=1" target="_blank">http://host/emilie%20simon?tst=1</a>
to be passed as
<a style='text-decoration: underline;' href="http://host/search.cgi?query=emilie%20simon&tst=1" target="_blank">http://host/search.cgi?query=emilie%20simon&tst=1</a>

Don't forget to setup rewrite logging and to observe its writings. If things
don't work out, do copy and past a few lines of it in your next post.

HansH<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Trying to build a similar request than A9's. - rewrite new.. 
Back to top
Login to vote
stromboli2

External


Since: Oct 07, 2004
Posts: 4



(Msg. 3) Posted: Sun Oct 10, 2004 8:14 pm
Post subject: Re: Trying to build a similar request than A9's. - rewrite newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,
I put it in the VirtualHost content. It worked!
But know when I call other scripts in the cgi-bin, instead of calling
them, it calls the search.cgi.
Is there any way to avoit rewrite to reconstruct sentences like
myhost.com/cgi-bin?
Cordially,
Strom
 > RewriteMap decode int:escape
 > RewriteRule (.*) /search\.cgi?query=${decode:$1} [QSA]
 >
 > Don't think you need the PTflag and added QSA to allow
<font color=purple> > <a style='text-decoration: underline;' href="http://host/emilie%20simon?tst=1</font" target="_blank">http://host/emilie%20simon?tst=1</font</a>>
 > to be passed as
<font color=purple> > <a style='text-decoration: underline;' href="http://host/search.cgi?query=emilie%20simon&tst=1</font" target="_blank">http://host/search.cgi?query=emilie%20simon&tst=1</font</a>>
 >
 > Don't forget to setup rewrite logging and to observe its writings. If things
 > don't work out, do copy and past a few lines of it in your next post.
 >
 > HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Trying to build a similar request than A9's. - rewrite new.. 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 4) Posted: Mon Oct 11, 2004 5:57 am
Post subject: Re: Trying to build a similar request than A9's. - rewrite newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Stromboli" <stromboli2 RemoveThis @hotpop.com> schreef in bericht
news:7096359e.0410101614.440c7a29@posting.google.com...
  > > RewriteMap decode int:escape
  > > RewriteRule (.*) /search\.cgi?query=${decode:$1} [QSA]
  > >
  > > Don't think you need the PTflag and added QSA to allow
<font color=green>  > > <a style='text-decoration: underline;' href="http://host/emilie%20simon?tst=1</font" target="_blank">http://host/emilie%20simon?tst=1</font</a>>
  > > to be passed as
<font color=green>  > > <a style='text-decoration: underline;' href="http://host/search.cgi?query=emilie%20simon&tst=1</font" target="_blank">http://host/search.cgi?query=emilie%20simon&tst=1</font</a>>
  > >
  > > Don't forget to setup rewrite logging and to observe its writings. If
things
  > > don't work out, do copy and past a few lines of it in your next post.
 > I put it in the VirtualHost content. It worked!
As in any %nn comes as we hooped for? Great!

 > But now when I call other scripts in the cgi-bin, instead of calling
 > them, it calls the search.cgi.
Yep, it interferes in any and all requests. It should even temper a request
for index.html Wink

 > Is there any way to avoid rewrite to reconstruct sentences like
 > myhost.com/cgi-bin?
Sure, just add above the RewriteRule
RewriteCond %{REQUEST_URI} !^/(cgi-bin|sample|sample2)/
This will keep the RewriteRule from changing requests involving either of
the three folders listed.

Adding
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
instead, should keep the rule from acting on any request for an existing
file or folder.

However, performance wise it might be better to reserve a foldername, like
'lookingfor', for request to be altered by just changing the rule a little:
RewriteRule /lookingfor/(.*) /search\.cgi?query=${decode:$1}
[QSA]

Finally good readings start at
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.1/mod/mod_rewrite.html" target="_blank">http://httpd.apache.org/docs-2.1/mod/mod_rewrite.html</a>

HansH<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Trying to build a similar request than A9's. - rewrite new.. 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]