You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Laurent Blume <la...@elanor.org> on 2007/09/11 15:17:15 UTC
[users@httpd] Redirecting temporarily all pages to /
Hi all,
I've hit soetmhing that seemed obvious at first, and I can't get it to work:
I want to be able to do a temporary redirect all accesses to the web
server to / in some cases (maintenance work mainly).
I though that something like that would do, with a single dot to ensure
that only non-empty URLs would go to /:
RedirectMatch permanent ^/. /
But it doesn't work, actually, the empty URL is redirected as well. How
come? I don't understand how it would match?
Any idea? I've googled around, but with no luck. Examples usually show
redirection to a different server, which is not what I want to do.
TIA,
Laurent
--
/ Leader de Projet & Communauté | I'm working, but not speaking for
\ G11N http://fr.opensolaris.org | Bull Services http://www.bull.com
/ FOSUG http://guses.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] Redirecting temporarily all pages to /
Posted by Laurent Blume <la...@elanor.org>.
Bj a écrit :
> Check if your index.hml and if any ErrorDocument directives are not
> interacting.
No, it's a very simple httpd.conf, no ErrorDocument, almost no module
actually, only the basic minimum to display a warning message.
> and try with Rewrite :
> RewriteEngine On
>
> RewriteCond %{REQUEST_URI} ^/.+$ [NC]
> RewriteCond %{REQUEST_URI} !^/$ [NC]
>
> RewriteRule ^/.* http://www.google.fr [L,R=302]
That works, redirecting everything to /. Well, I wanted to follow the
Best Practice, which recommends using RedirectMatch in that case, and
it's one more module to load, but that will do fine.
Thanks for your help!
Laurent
--
/ Leader de Projet & Communauté | I'm working, but not speaking for
\ G11N http://fr.opensolaris.org | Bull Services http://www.bull.com
/ FOSUG http://guses.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] Redirecting temporarily all pages to /
Posted by Bj <bj...@gmail.com>.
Check if your index.hml and if any ErrorDocument directives are not
interacting.
and try with Rewrite :
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/.+$ [NC]
RewriteCond %{REQUEST_URI} !^/$ [NC]
RewriteRule ^/.* http://www.google.fr [L,R=302]
--
Bj
On 9/11/07, Laurent Blume <la...@elanor.org> wrote:
>
> Hi all,
>
> I've hit soetmhing that seemed obvious at first, and I can't get it to
> work:
> I want to be able to do a temporary redirect all accesses to the web
> server to / in some cases (maintenance work mainly).
>
> I though that something like that would do, with a single dot to ensure
> that only non-empty URLs would go to /:
> RedirectMatch permanent ^/. /
>
> But it doesn't work, actually, the empty URL is redirected as well. How
> come? I don't understand how it would match?
>
> Any idea? I've googled around, but with no luck. Examples usually show
> redirection to a different server, which is not what I want to do.
>
> TIA,
>
> Laurent
> --
> / Leader de Projet & Communauté | I'm working, but not speaking for
> \ G11N http://fr.opensolaris.org | Bull Services http://www.bull.com
> / FOSUG http://guses.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
>
>