You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Justin French <ju...@indent.com.au> on 2003/02/03 03:54:01 UTC

[users@httpd] url re-writing

Can someone point me to a decent article?

I want to rewrite all foofoo.com/something/page.html URLs to
bahbah.com/something/page.html, via a .htaccess file in a directory.

In other words

foofoo.com/ exists
foofoo.com/something/page.html doesn't exist
replace/rewrite foofoo.com with bahbah.com


TIA,

Justin French


---------------------------------------------------------------------
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] url re-writing

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

did you check your error_log?
You need "AllowOverride FileInfo" in the server or virtualhost configuration.
You probably have to use
  RewriteRule   ^/(.+)  http://203.217.25.241/$1  [R,L]
instead.

Jurgen


On Mon, 03 Feb 2003 19:51:19 +1100
Justin French <ju...@indent.com.au> wrote:

> > it is generally possible, but you have to make sure that no "AllowOverride"
> > directive in the server or virtualhost configuration prohibits that.
> > 
> > Jurgen
> 
> I've got the following .htaccess file:
> 
> ---
> RewriteEngine on
> RewriteRule   ^(.+)  http://203.217.25.241/$1  [R,L]
> 
> <Files ~ "\.inc$">
>     Order Allow,Deny
>     Deny from all
> </Files>
> ---
> 
> The Files directive works fine, refusing a *.inc file, but the rewriting is
> not working... does it need to be wrapped in "tags" like the files stuff?
> 
> 
> Justin
> 
> 
> ---------------------------------------------------------------------
> 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

---------------------------------------------------------------------
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] url re-writing

Posted by Justin French <ju...@indent.com.au>.
> it is generally possible, but you have to make sure that no "AllowOverride"
> directive in the server or virtualhost configuration prohibits that.
> 
> Jurgen

I've got the following .htaccess file:

---
RewriteEngine on
RewriteRule   ^(.+)  http://203.217.25.241/$1  [R,L]

<Files ~ "\.inc$">
    Order Allow,Deny
    Deny from all
</Files>
---

The Files directive works fine, refusing a *.inc file, but the rewriting is
not working... does it need to be wrapped in "tags" like the files stuff?


Justin


---------------------------------------------------------------------
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] url re-writing

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

it is generally possible, but you have to make sure that no "AllowOverride" directive in the server or virtualhost configuration prohibits that.

Jurgen


On Mon, 03 Feb 2003 18:46:43 +1100
Justin French <ju...@indent.com.au> wrote:

> Excellent -- I read that link... just to clarify, I wanted to re-write
> "anything" at the domain, not "something" :)
> 
> Had a read, and saw this:
> 
> ---
> http://newserver/~user/anypath.
> RewriteEngine on
> RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]
> ---
> 
> So, it looks like I can adapt this to suit:
> 
> RewriteEngine on
> RewriteRule   ^(.+)  http://xxx.xxx.xxx.xxx/$1  [R,L]
> 
> Hoping I can do this in a .htaccess file at a per-directory level, and all
> will be good, but it doesn't appear to be working so far...
> 
> 
> TIA
> Justin
> 
> 
> 
> on 03/02/03 5:50 PM, Jurgen (apache@squarehosting.com) wrote:
> 
> > Hi,
> > 
> > this is not complicated and at
> > http://httpd.apache.org/docs/misc/rewriteguide.html you should find all the
> > information you need.
> > Something like
> > RewriteRule ^/something(.*) http://bahbah.com/something$1
> > should do it.
> > If you want to proxy or redirect you have to add [P] or [R] at the end of the
> > line.
> > 
> > Jurgen
> > 
> > 
> > On Mon, 03 Feb 2003 13:54:01 +1100
> > Justin French <ju...@indent.com.au> wrote:
> > 
> >> Can someone point me to a decent article?
> >> 
> >> I want to rewrite all foofoo.com/something/page.html URLs to
> >> bahbah.com/something/page.html, via a .htaccess file in a directory.
> >> 
> >> In other words
> >> 
> >> foofoo.com/ exists
> >> foofoo.com/something/page.html doesn't exist
> >> replace/rewrite foofoo.com with bahbah.com
> >> 
> >> 
> >> TIA,
> >> 
> >> Justin French
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> 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
> > 
> > ---------------------------------------------------------------------
> > 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
> > 
> > ---
> > [This E-mail scanned for viruses]
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> 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

---------------------------------------------------------------------
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] url re-writing

Posted by Justin French <ju...@indent.com.au>.
Excellent -- I read that link... just to clarify, I wanted to re-write
"anything" at the domain, not "something" :)

Had a read, and saw this:

---
http://newserver/~user/anypath.
RewriteEngine on
RewriteRule   ^/~(.+)  http://newserver/~$1  [R,L]
---

So, it looks like I can adapt this to suit:

RewriteEngine on
RewriteRule   ^(.+)  http://xxx.xxx.xxx.xxx/$1  [R,L]

Hoping I can do this in a .htaccess file at a per-directory level, and all
will be good, but it doesn't appear to be working so far...


TIA
Justin



on 03/02/03 5:50 PM, Jurgen (apache@squarehosting.com) wrote:

> Hi,
> 
> this is not complicated and at
> http://httpd.apache.org/docs/misc/rewriteguide.html you should find all the
> information you need.
> Something like
> RewriteRule ^/something(.*) http://bahbah.com/something$1
> should do it.
> If you want to proxy or redirect you have to add [P] or [R] at the end of the
> line.
> 
> Jurgen
> 
> 
> On Mon, 03 Feb 2003 13:54:01 +1100
> Justin French <ju...@indent.com.au> wrote:
> 
>> Can someone point me to a decent article?
>> 
>> I want to rewrite all foofoo.com/something/page.html URLs to
>> bahbah.com/something/page.html, via a .htaccess file in a directory.
>> 
>> In other words
>> 
>> foofoo.com/ exists
>> foofoo.com/something/page.html doesn't exist
>> replace/rewrite foofoo.com with bahbah.com
>> 
>> 
>> TIA,
>> 
>> Justin French
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 
> ---------------------------------------------------------------------
> 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
> 
> ---
> [This E-mail scanned for viruses]
> 
> 


---------------------------------------------------------------------
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] url re-writing

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

this is not complicated and at http://httpd.apache.org/docs/misc/rewriteguide.html you should find all the information you need.
Something like
 RewriteRule ^/something(.*) http://bahbah.com/something$1
should do it.
If you want to proxy or redirect you have to add [P] or [R] at the end of the line.

Jurgen


On Mon, 03 Feb 2003 13:54:01 +1100
Justin French <ju...@indent.com.au> wrote:

> Can someone point me to a decent article?
> 
> I want to rewrite all foofoo.com/something/page.html URLs to
> bahbah.com/something/page.html, via a .htaccess file in a directory.
> 
> In other words
> 
> foofoo.com/ exists
> foofoo.com/something/page.html doesn't exist
> replace/rewrite foofoo.com with bahbah.com
> 
> 
> TIA,
> 
> Justin French
> 
> 
> ---------------------------------------------------------------------
> 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

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