Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Mod Rewrite question - newbie

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  jk2 and creating jkjni.so  
Author Message
carla_tf

External


Since: Jun 11, 2004
Posts: 4



(Msg. 1) Posted: Fri Jun 11, 2004 7:33 pm
Post subject: Mod Rewrite question - newbie
Archived from groups: alt>apache>configuration (more info?)

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 I user click on http://sub.dom.com/fish.html apache
serves http://dom.com/cgi/s.cgi?query=fish 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$ http://dom.com/cgi/search.cgi\?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?.
Cordially,
Carla


---------------------------------------------------------
i used to have a quote...

www.ithaki.net,
metasearch engine: searching wisely more than 500 search engines
worldwide.

www.extratitles.to: Divx Subtitles

 >> Stay informed about: Mod Rewrite question - newbie 
Back to top
Login to vote
purlgurl

External


Since: Oct 24, 2003
Posts: 127



(Msg. 2) Posted: Fri Jun 11, 2004 8:57 pm
Post subject: Re: Mod Rewrite question - newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Carla wrote:

(snipped)

 > I want that when I user click 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:

 > 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

 > 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?

Use Server Side Includes (SSI) instead. You may include almost
any file, including cgi applications, in a static html page using
SSI. There is a slight disadvantage. You use slightly more system
resources and your page "might" load a little slower depending on
how much content data is delivered to your static page. There are
some security concerns which are easy to address.

Hiding URL addresses is an age old problem which has never
been resolved. There are many techniques to hide an address
but with little effort, an address can be found.

This is not true with Server Side Includes. There is no hint
of remote inclusion, unless there is a script error, even
then your remote address is not disclosed.


<a style='text-decoration: underline;' href="http://www.apacheweek.com/features/ssi" target="_blank">http://www.apacheweek.com/features/ssi</a>

<a style='text-decoration: underline;' href="http://cjhosting.com/members/faqssi.html" target="_blank">http://cjhosting.com/members/faqssi.html</a>

<a style='text-decoration: underline;' href="http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html" target="_blank">http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html</a>


Very easy to learn how to use includes, very easy to write
include code, which is really simple html markup. Really nice
effects can be had with a very wide range of options, which
include search results based on your key term, "fish."


Purl Gurl<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Mod Rewrite question - newbie 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 3) Posted: Sat Jun 12, 2004 4:39 pm
Post subject: Re: Mod Rewrite question - newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"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 
Back to top
Login to vote
carla_tf

External


Since: Jun 11, 2004
Posts: 4



(Msg. 4) Posted: Mon Jun 14, 2004 6:44 pm
Post subject: Re: Mod Rewrite question - newbie [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"HansH" <hans.DeleteThis@niet.op.het.net> wrote in message news:<caeq18$mom$1@news.cistron.nl>...
 > 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
thanks HansH, it worked nice. this is what I wanted to do!. I'm using
Apache 1.3 and if I put the rewrite commands inside <virtualhost> it
gives me an error and it won't restart the server, that's why I put
them inside <Directory><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Mod Rewrite question - newbie 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Rewrite newbie question and mod_GeoIP - Hi, I've got a very simple problem, as I've been trying to solve it for hours I decided to post it here. Please don't laugh because of its simplicity. I've succesfully installed de mod GeoIP on my box. I want to redirect all the users that arrive to the....

[Rewrite Newbie] Rules question - Hello everybody! I'm not very good in regular expressions and the rules for mod_rewrite, that's why i come here to ask you for a little help. I want in the .htacces file 3 rules: When someone types www.domain.tld, i want to send everything to the..

newbie: mod rewrite - i would like some advice with this, what i want to achieve is to make a url like this: tharrison.net/browse/wrexham-programmes to pass variables the words wrexham programmes to a script in the base directory, i didnt explain that very well, i mean so....

Newbie: Wikipedia - rewrite redirect ??? - Hey, i have installed wikimedia on my local computer, now the pages are always like wiki/index.php?title=Mainpage how can i maked it like wikipedia that it looks like wiki/Mainpage? thanks, liss

mod rewrite multiple domains newbie - Hi, I am relatively new to mod_rewrite, so bear with me. I have webspace that allows me host multiple domains on my webspace. I am trying to point each domain to its own subfolder in my webspace. I have set up subfolders in my space that have the name...
   Web Hosting Problem Solving Community! (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 ]