httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hall" <dh...@utrs.com>
Subject RE: [users@httpd] URL Rewriting trouble with Apache 2.2
Date Fri, 21 Apr 2006 15:57:42 GMT
Stephen, 

First of all, thanks for your help.
I knew it was an easy fix. My lack of RexEx knowledge was shooting me in the
foot.

mod_dir is now loading when Apache starts.
I changed my code in the VirtualHost block in httpd-vhosts.conf to look like
this:

</VirtualHost>
[...]
    # list of redirects
    RedirectMatch ^/$ /home/index.html [R]
</VirtualHost>

And that did it.

One last question, though. This fixed my redirection for just this virtual
host. Do I need to repeat this in each virtual host on the server, or can I
put the redirect code in another location so it will apply to all virtual
hosts on this server?

Thanks,

Darren


-----Original Message-----
From: S.Hayles [mailto:sh23@leicester.ac.uk] 
Sent: Friday, April 21, 2006 11:38 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] URL Rewriting trouble with Apache 2.2


On Fri, 21 Apr 2006, Darren Hall wrote:
[...]
> The first rewrite adds a trailing slash to the url when requesting any
> directory in the site (or anything that is not a document).
[...]

Given that you want the modified URL to appear in the browser, you need to 
perform a redirect. A redirect with added slash for directories is what 
mod_dir does (and I'm sure it will be there in a default install).

See http://httpd.apache.org/docs/2.2/mod/mod_dir.html

[...]
> RewriteRule \.org/$ \.org/home/index.jsp [R]
[...]

The string that the rewrite rule matches does not include the hostname, so 
you just need to match ^/$

(If you do want to test the hostname, see RewriteCond)

Steven

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


Mime
View raw message