RE: [users@httpd] URL Rewriting trouble with Apache 2.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx] 
Sent: Friday, April 21, 2006 11:38 AM
To: users@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux