You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lothar Krenzien <lk...@web.de> on 2006/08/22 15:17:42 UTC
[users@httpd] redirect only if a URL does not exists
Hi there,
I'm using Apache 2.2 from the xampp project on Windows XP and 2003. Now I want to redirect a request *ONLY* if the URL does not exist. I know the !-U flag for a RewriteCond but can't get it working. Here's what I tried to do :
<IfModule mod_rewrite.c>
RewriteEngine On
...
RewriteCond %{REQUEST_URI} !-U
RewriteRule ^/(.*).do http://localhost/Portal_Update.php
...
</IfModule>
This results in an 503 error so it seems that the RewriteRule was not executed.
Second try :
RewriteCond %{QUERY_STRING} !-U
RewriteRule ^/(.*).do http://localhost/Portal_Update.php
This rule is exeuted *everytime*, even if the requested URL exists.
Third try
RewriteCond %{THE_REQUEST} !-U
RewriteRule ^/(.*).do http://localhost/Portal_Update.php
This results in an 502 error so it also seems that the RewriteRule was not executed.
And my last try :
RewriteCond ^/conergy/(.*).do !-U
RewriteRule ^/conergy/(.*).do http://localhost/Portal_Update.php
This rule is also exeuted *everytime*, even if the requested URL exists.
Also define an ErrorDocument for error 502 or 503 didn't worked.
So what I'm doing wrong ?
Thanks, Lothar
---------------------------------------------------------------------
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] redirect only if a URL does not exists
Posted by Steve Swift <st...@gmail.com>.
The simplest way to achieve what you want would be with
ErrorDocument 404 /where/you/want/to/go
On 23/08/06, Bob Ionescu <bo...@googlemail.com> wrote:
>
> Lothar Krenzien wrote:
> > Hi there,
> >
> > Now I want to redirect a request *ONLY* if the URL does not exist. I
> know the !-U flag for a RewriteCond but can't get it working.
>
> -U checks only access controls and not if your URL-path resolves to an
> existing resource.
>
> ---------------------------------------------------------------------
> 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
>
>
--
Steve Swift
http://www.swiftys.org.uk
Re: [users@httpd] redirect only if a URL does not exists
Posted by Bob Ionescu <bo...@googlemail.com>.
Lothar Krenzien wrote:
> Hi there,
>
> Now I want to redirect a request *ONLY* if the URL does not exist. I know the !-U flag for a RewriteCond but can't get it working.
-U checks only access controls and not if your URL-path resolves to an
existing resource.
---------------------------------------------------------------------
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] redirect only if a URL does not exists
Posted by Joshua Slive <jo...@slive.ca>.
On 8/22/06, Lothar Krenzien <lk...@web.de> wrote:
> Hi there,
>
> I'm using Apache 2.2 from the xampp project on Windows XP and 2003. Now I want to redirect a request *ONLY* if the URL does not exist. I know the !-U flag for a RewriteCond but can't get it working. Here's what I tried to do :
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
> ...
> RewriteCond %{REQUEST_URI} !-U
> RewriteRule ^/(.*).do http://localhost/Portal_Update.php
> ...
> </IfModule>
>
> This results in an 503 error so it seems that the RewriteRule was not executed.
Start by using the RewriteLog so you can see exactly what is in the
variables you are using.
Joshua.
---------------------------------------------------------------------
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