1

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!

3
  • How did you implement your redirect?
    – MrWhite
    May 21 '17 at 16:16
  • Redirect permanent / mysite/owncloud
    – human374
    May 21 '17 at 16:19
  • Is www/other/directory/file.txt a filesystem path or URL?
    – MrWhite
    May 21 '17 at 16:24
3
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.

1
  • What happened to your user name? You looks so anonymous now. :( May 21 '17 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.