You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by DIGLLOYD INC <di...@diglloyd.com> on 2008/04/24 18:53:27 UTC

simple way to rewrite simple URL portion

I'm looking for a very very basic URL-rewriting filter--simple text  
substitution.  I suppose I can write my own since the functionality I  
need is so limited, but I was hoping there was something built-in in  
Tomcat.

For past reasons, I get requests that include the path "bike/free".   
Right now those all 404 into /errors/error404.html.  The bike/free  
requests will probably stay around for years (hundreds of originating  
links), so I want to permanently map "bike/free" to "diglloyd/free" eg:

     http://diglloyd.com/bike/free/...
to:
     http://diglloyd.com/diglloyd/free/...

What's the easiest way to alter any URL containing "bike/free" to read  
"diglloyd/free"?

Lloyd


Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]





Re: simple way to rewrite simple URL portion

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lloyd,

DIGLLOYD INC wrote:
| Thank you Christopher I'll take a look at the link.  More than I need
| now, but maybe there will be other uses too...

Anything is better than re-inventing the wheel ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQv7MACgkQ9CaO5/Lv0PAJ5QCfZESceolbw7KCLqx2rp+IV3x0
wsIAniR6C7p1GuDsios6unFE34kPUkTD
=b1zi
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by DIGLLOYD INC <di...@diglloyd.com>.
Thank you Christopher I'll take a look at the link.  More than I need  
now, but maybe there will be other uses too...

(I'm just running Tomcat standalone, no httpd in front)


On Apr 24, 2008, at 10:01 AM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lloyd,
>
> DIGLLOYD INC wrote:
> | I'm looking for a very very basic URL-rewriting filter--simple text
> | substitution.  I suppose I can write my own since the  
> functionality I
> | need is so limited, but I was hoping there was something built-in in
> | Tomcat.
>
> Not built-in, but definitely exists:
>
> http://tuckey.org/urlrewrite/
>
> | For past reasons, I get requests that include the path "bike/free".
> | Right now those all 404 into /errors/error404.html.  The bike/free
> | requests will probably stay around for years (hundreds of  
> originating
> | links), so I want to permanently map "bike/free" to "diglloyd/ 
> free" eg:
> |
> |     http://diglloyd.com/bike/free/...
> | to:
> |     http://diglloyd.com/diglloyd/free/...
> |
> | What's the easiest way to alter any URL containing "bike/free" to  
> read
> | "diglloyd/free"?
>
> If you are using Apache httpd to front your Tomcat, you can probably  
> use
> either mod_rewrite (upon which the above urlrewrite was based) or the
> simpler RedirecrPermanent directives to achieve the same goal. I  
> believe
> Apache httpd configuration might be a bit simpler, but don't add  
> Apache
> httpd to your configuration just for this -- it would be a huge  
> waste of
> effort and added complexity.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkgQvN4ACgkQ9CaO5/Lv0PCzKACdGi0QMyJLcRaZQthBuBjDfmYJ
> Ei4AnjhBd5Lkl31zzG/diVHjhmONdJRU
> =OIqw
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lloyd,

DIGLLOYD INC wrote:
| I'm looking for a very very basic URL-rewriting filter--simple text
| substitution.  I suppose I can write my own since the functionality I
| need is so limited, but I was hoping there was something built-in in
| Tomcat.

Not built-in, but definitely exists:

http://tuckey.org/urlrewrite/

| For past reasons, I get requests that include the path "bike/free".
| Right now those all 404 into /errors/error404.html.  The bike/free
| requests will probably stay around for years (hundreds of originating
| links), so I want to permanently map "bike/free" to "diglloyd/free" eg:
|
|     http://diglloyd.com/bike/free/...
| to:
|     http://diglloyd.com/diglloyd/free/...
|
| What's the easiest way to alter any URL containing "bike/free" to read
| "diglloyd/free"?

If you are using Apache httpd to front your Tomcat, you can probably use
either mod_rewrite (upon which the above urlrewrite was based) or the
simpler RedirecrPermanent directives to achieve the same goal. I believe
Apache httpd configuration might be a bit simpler, but don't add Apache
httpd to your configuration just for this -- it would be a huge waste of
effort and added complexity.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQvN4ACgkQ9CaO5/Lv0PCzKACdGi0QMyJLcRaZQthBuBjDfmYJ
Ei4AnjhBd5Lkl31zzG/diVHjhmONdJRU
=OIqw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by Mark Thomas <ma...@apache.org>.
DIGLLOYD INC wrote:
> I've got another issue--

Then start another thread.

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by DIGLLOYD INC <di...@diglloyd.com>.
I've got another issue--

I want to place an index.jsp file in certain directories that simply  
loads another page eg:
<jsp:forward page="some-other-page.html" />

This works fine for a page in the same directory.  But my site uses  
relative links heavily, so if I do this:

<jsp:forward page="../some-other-page.html" />

All that pages relative links don't work, since they seem to be  
relative to the originating directory, not the parent directory.

I want to use relative links, I have a huge amount of static content,  
so this is a real headache.

Any solution to this?  It seems bizarre that a forward doesn't  
reestablish the correct directory.


Lloyd


On Apr 24, 2008, at 10:57 AM, Ken Bowen wrote:

> Take a look at
>
> http://tuckey.org/urlrewrite/
>
> I found it very easy to use for exactly the kind of problem you  
> described.
>
> P.S. Your eagles are great.
>
> On Apr 24, 2008, at 12:53 PM, DIGLLOYD INC wrote:
>
>> I'm looking for a very very basic URL-rewriting filter--simple text  
>> substitution.  I suppose I can write my own since the functionality  
>> I need is so limited, but I was hoping there was something built-in  
>> in Tomcat.
>>
>> For past reasons, I get requests that include the path "bike/ 
>> free".  Right now those all 404 into /errors/error404.html.  The  
>> bike/free requests will probably stay around for years (hundreds of  
>> originating links), so I want to permanently map "bike/free" to  
>> "diglloyd/free" eg:
>>
>>   http://diglloyd.com/bike/free/...
>> to:
>>   http://diglloyd.com/diglloyd/free/...
>>
>> What's the easiest way to alter any URL containing "bike/free" to  
>> read "diglloyd/free"?
>>
>> Lloyd
>>
>>
>> Lloyd Chambers
>> http://diglloyd.com
>>
>> [Mac OS X 10.5.2 Intel, Tomcat 6.0.16]
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Lloyd Chambers
http://diglloyd.com

[Mac OS X 10.5.2 Intel, Tomcat 6.0.16]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by Ken Bowen <kb...@als.com>.
Take a look at

http://tuckey.org/urlrewrite/

I found it very easy to use for exactly the kind of problem you  
described.

P.S. Your eagles are great.

On Apr 24, 2008, at 12:53 PM, DIGLLOYD INC wrote:

> I'm looking for a very very basic URL-rewriting filter--simple text  
> substitution.  I suppose I can write my own since the functionality  
> I need is so limited, but I was hoping there was something built-in  
> in Tomcat.
>
> For past reasons, I get requests that include the path "bike/free".   
> Right now those all 404 into /errors/error404.html.  The bike/free  
> requests will probably stay around for years (hundreds of  
> originating links), so I want to permanently map "bike/free" to  
> "diglloyd/free" eg:
>
>    http://diglloyd.com/bike/free/...
> to:
>    http://diglloyd.com/diglloyd/free/...
>
> What's the easiest way to alter any URL containing "bike/free" to  
> read "diglloyd/free"?
>
> Lloyd
>
>
> Lloyd Chambers
> http://diglloyd.com
>
> [Mac OS X 10.5.2 Intel, Tomcat 6.0.16]
>
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: simple way to rewrite simple URL portion

Posted by Hassan Schroeder <ha...@gmail.com>.
On Thu, Apr 24, 2008 at 9:53 AM, DIGLLOYD INC <di...@diglloyd.com> wrote:
> I'm looking for a very very basic URL-rewriting filter

    <http://tuckey.org/urlrewrite/>

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org