Apache https redirect


I followed the owncloud manual and added

<VirtualHost *:80>
   ServerName example.com
   Redirect permanent / https://example.com/

to the vhost-file. The problem is that if I type example.com/owncloud I get redirected to https://example.comowncloud. But it works if I type example.com/owncloud/.
Also if I type in the IP xxx.xxx.x.x/owncloud/ I get redirected to https://xxx.xxx.x.x/owncloud/owncloud, but it works if I just type xxx.xxx.x.x/owncloud…
Any ideas?


You will need to describe what guide you’re referencing setting up owncloud so others can inspect and verify whether the instructions are accurate and if you might not be following the guide correctly.

Aside from that, the redirect method you’re implementing appears to be base on host headers (the name, not IP address of your website).
If you want to implement an IP-based re-direct, try entering another line using the IP address instead of your website name.

Your confusion about when a website’s root might re-direct vs a subdirectory will depend largely on how your website is set up (supporting multiple websites on the same IP address or not) and the website architecture implementing virtual directories.

I’m going to guess you aren’t setting up your website correctly, but if you are then you may have to ask your question in an owncloud forum.