"Carla" <carla_tf.TakeThisOut@ciudad.com.ar> schreef in bericht
news:6b24edfc.0406111533.3b3d29ca@posting.google.com...
> Hi, I'm Carla, I'm a mod rewrite totally newbie-
> I'm trying to make search pages to look as html pages (mainly for
> search engines).
> I want that when a user clicks on <a style='text-decoration: underline;' href="http://sub.dom.com/fish.html" target="_blank">http://sub.dom.com/fish.html</a> apache
> serves <a style='text-decoration: underline;' href="http://dom.com/cgi/s.cgi?query=fish" target="_blank">http://dom.com/cgi/s.cgi?query=fish</a> but I don't want to display
> the second address.
> To do that I added to httpd.conf:
> <Directory "/var/www/dom.com/sub">
> RewriteEngine on
> Options +FollowSymlinks
> RewriteBase /
> RewriteRule ^(.*).html$ <a style='text-decoration: underline;' href="http://dom.com/cgi/search.cgi" target="_blank">http://dom.com/cgi/search.cgi</a>\?query=$1
> </Directory>
>
> Now, the server delivers the page but it shows the real address
> (dot.com/blablabla). What I have to add to avoid Apache to show the
> real address?.
Do you really mean to rewrite to another domain or (virtual) server??
That will cause Apache to send a redirect and the browser will [have to]
request from that new location.
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewriterule" target="_blank">http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewriterule</a>
You just have to avoid sending a redirect to the browser -but you cann't if
you have to redirect cross-domain.- so change your rule to
RewriteRule ^(.*).html$ /cgi/search.cgi\?query=$1
If your only reason for cross-domain rewrites is accessing the cgi-folder at
dom.com, and dom.com and sub.dom.com are set up as <virtualhost...>s,
consider moving your rewrite inside the <virtualhost ...> for sub.dom.com
and add a scriptalias too, alike:
NameVirtualHost *
<virtualhost *>
NameVirtualHost sub.dom.com
DocumentRoot /var/www/dom.com/sub
ScriptAlias /cgi/ /var/www/dom.com/cgi
RewriteEngine on
RewriteRule ^(.*).html$ /cgi/search.cgi\?query=$1 [PT]
</virtualhost >
HansH<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Mod Rewrite question - newbie