I have an owncloud server which is using HTTPS (www/owncloud). I redirected all HTTP request to HTTPS. Now I need to reach one file using HTTP (www/other/directory/file.txt). How can I achive this without making any other files reachable through HTTP?

Thanks in advance!

  • How did you implement your redirect?
  • Redirect permanent / mysite/owncloud
  • Is www/other/directory/file.txt a filesystem path or URL?
Redirect permanent / https://mysite/owncloud 

You'll need to change this to mod_rewrite in order to implement an exception for the URL you want to keep on HTTP. For example:

RewriteEnging On ReeriteCond %{REQUEST_URI} !^/other/directory/file\.txt RewriteRule (.*) https://mysite/owncloud/$1 [R,L] 

I've assuming www is your document root (from your redirect) and so /other is a root-relative URL, relative to this document root?

This is also a temporary (302) redirect, so change R to R=301 when you are sure it's working OK.

You'll need to make sure your browser cache is clear before testing.

  • What happened to your user name? You looks so anonymous now. :(

Pracoval pro vás: Charles Robertson | Chcete nás kontaktovat?