Re: Redirect https' 404 to http...

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

 



On Fri, Nov 25, 2011 at 11:54 AM, John Doe <jdmls@xxxxxxxxx> wrote:
> Hi,
>
> Apache newbie here.
>
> is there a simple way to redirect all https' 404 to http?
> I searched for some solutions but could not find any...
>
> Is there a rewrite variable that holds the http return code?

Interesting one. There is nothing that holds the return code by
default, as that would mean completing the request in the rewrite
phase, which wouldn't make much sense.

What you can do is do an 'is an existing URL check, via a subrequest'
with the -U flag. Something like this:

RewriteCond %{HTTPS} On
RewriteCond ! -U %{REQUEST_URI}
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

However, I would never do this. This would make every single SSL
request make an additional request to see if the URL exists, which
would be very expensive.

If you were only interested in static files, than that is easier, you
can use the -f (file test), which would not use a sub request.
However, if it were just static files, you would probably just serve
them..

Cheers

Tom

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