You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Manivel Arumugam <ma...@gmail.com> on 2007/08/17 08:11:53 UTC

[users@httpd] Mod Rewrite Help

Hi,

There is a need to configure a rewrite rule for the following source
url to point to a target url.

Source url - http://usearch.3m.com:8765/abc.html

If you closely look at the above url, you can see a port number in it.
I'm not that expert with rewrites and have never done this in the past
either. Any help on how to set up this rewrite with port number would
be much appreciated.

Thanks
Mani

---------------------------------------------------------------------
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] Mod Rewrite Help

Posted by Jack Stone <an...@hotmail.com>.
>From: "Joshua Slive" <jo...@slive.ca>
>Reply-To: users@httpd.apache.org
>To: users@httpd.apache.org, orvilleg@hotmail.com
>Subject: Re: [users@httpd] Mod Rewrite Help
>Date: Sun, 19 Aug 2007 13:28:31 -0400
>
>On 8/19/07, Jack Stone <an...@hotmail.com> wrote:
>
> > I've wondered if is is necessary to use the RewriteEngine every time 
>another
> > redirect set is used like this for example:
>
>This is one of those questions that I wonder why you bother asking.
>Why not just try it and see if it works.
>
>But anyway, you only need the RewriteEngine once.
>
>Joshua.

Appreciate the answer since I couldn't find it in the docs.

Jack

_________________________________________________________________
Find a local pizza place, movie theater, and moreĀ….then map the best route! 
http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01


---------------------------------------------------------------------
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] Mod Rewrite Help

Posted by Joshua Slive <jo...@slive.ca>.
On 8/19/07, Jack Stone <an...@hotmail.com> wrote:

> I've wondered if is is necessary to use the RewriteEngine every time another
> redirect set is used like this for example:

This is one of those questions that I wonder why you bother asking.
Why not just try it and see if it works.

But anyway, you only need the RewriteEngine once.

Joshua.

---------------------------------------------------------------------
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] Mod Rewrite Help

Posted by Jack Stone <an...@hotmail.com>.
>From: "Joshua Slive" <jo...@slive.ca>
>Reply-To: users@httpd.apache.org
>To: users@httpd.apache.org
>Subject: Re: [users@httpd] Mod Rewrite Help
>Date: Fri, 17 Aug 2007 09:58:12 -0400
>
>On 8/17/07, wi <ic...@gmail.com> wrote:
> > You'll need to configure a virtual host listening to the 8765 interface.
> > Once you've done that, you will simply need to put together a rewrite to
> > send requests to /abc.html to whatever target url you want.
> >
> > Start by reading http://httpd.apache.org/docs/2.2/vhosts/
> >
> > From there, configuring the rewrite will be the next task.
>
>Or, if you don't want the virtual host, you can use a RewriteCond
>based on the %{SERVER_PORT} as mentioned here:
>http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
>
>Joshua.
>

More help question.

I've wondered if is is necessary to use the RewriteEngine every time another 
redirect set is used like this for example:

## stop offender & redirect to "why" page
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^webwalk [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^yodao
RewriteRule .* /usr/local/www/vhost/whystopped.htm

## replace stolen images with "illegal" image
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?vhost.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.mainhost.net/images/illegal.gif [R,L]

## forbidden 403
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Zango [NC,OR]
RewriteCond %{HTTP_USER_AGENT} link_checker
RewriteRule ^.* - [F,L]

.....or, could this be used, just turning on the engine once at the very 
top:

## stop offender & redirect to "why" page
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^webwalk [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^yodao
RewriteRule .* /usr/local/www/vhost/whystopped.htm

## replace stolen images with "illegal" image
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?vhost.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.mainhost.net/images/illegal.gif [R,L]

## forbidden 403
RewriteCond %{HTTP_USER_AGENT} Zango [NC,OR]
RewriteCond %{HTTP_USER_AGENT} link_checker
RewriteRule ^.* - [F,L]

Thanks for advice.

Jack

_________________________________________________________________
Booking a flight? Know when to buy with airfare predictions on MSN Travel. 
http://travel.msn.com/Articles/aboutfarecast.aspx&ocid=T001MSN25A07001


---------------------------------------------------------------------
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] Mod Rewrite Help

Posted by Joshua Slive <jo...@slive.ca>.
On 8/17/07, wi <ic...@gmail.com> wrote:
> You'll need to configure a virtual host listening to the 8765 interface.
> Once you've done that, you will simply need to put together a rewrite to
> send requests to /abc.html to whatever target url you want.
>
> Start by reading http://httpd.apache.org/docs/2.2/vhosts/
>
> From there, configuring the rewrite will be the next task.

Or, if you don't want the virtual host, you can use a RewriteCond
based on the %{SERVER_PORT} as mentioned here:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

Joshua.

---------------------------------------------------------------------
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] Mod Rewrite Help

Posted by wi <ic...@gmail.com>.
You'll need to configure a virtual host listening to the 8765 interface.
Once you've done that, you will simply need to put together a rewrite to
send requests to /abc.html to whatever target url you want.

Start by reading http://httpd.apache.org/docs/2.2/vhosts/

>From there, configuring the rewrite will be the next task.

cheers
Wayne


On 8/16/07, Manivel Arumugam <ma...@gmail.com> wrote:
>
> Hi,
>
> There is a need to configure a rewrite rule for the following source
> url to point to a target url.
>
> Source url - http://usearch.3m.com:8765/abc.html
>
> If you closely look at the above url, you can see a port number in it.
> I'm not that expert with rewrites and have never done this in the past
> either. Any help on how to set up this rewrite with port number would
> be much appreciated.
>
> Thanks
> Mani
>
> ---------------------------------------------------------------------
> 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
>
>


-- 
2X7 -> %A-3+ -> %K-7+ -> %9-?+ -> %Q-8 -> ?9-?9+