0

I'm trying to use .htaccess with the proxy tag to redirect owncloud.example.com to owncloud.example.com:7777/owncloud but i need the url in the adressbar to remain unchanged.

This is my current htaccess

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^owncloud\.example\.com [NC]
RewriteRule (.*) http://owncloud.example.com:7777/owncloud [P,L]

However with this configuration I get Proxy Error 502 when i try to browse to the web page.

I have mod_rewrite and mod_proxy enabled.

Devvix
  • 49
  • 1
  • 9
  • When you visit `http://owncloud.example.com:7777/owncloud`, directly does the URL stay that way? Are there any errors? If it's on the same machine, why not just use `http://localhost:7777/owncloud`? – Walf Nov 23 '16 at 11:05
  • if i visit that url it works, but i want to be able to connect without having to type the port and not seeing it in the adress bar. I have it working so that i get directed to that port and then it works, but i want to not be able to see for port. – Devvix Nov 23 '16 at 18:23
  • You didn't quite answer my question. – Walf Nov 23 '16 at 21:32
  • The error im getting when i try to connect is https://imgur.com/gallery/zlR8s – Devvix Nov 24 '16 at 01:33
  • And on some browsers it show error "502 proxy error". When i visit the url it becomes "http://owncloud.example.com:7777/owncloud/index.php/login", and it's not on the same machine – Devvix Nov 24 '16 at 01:34

1 Answers1

0

Looks like it needs the rest of the path info. You may also need to configure owncloud so that it thinks it's at http://owncloud.example.com/. Try this:

RewriteRule .* http://owncloud.example.com:7777/owncloud/$0 [P,L]
Walf
  • 8,535
  • 2
  • 44
  • 59
  • Try'd it out and it does work like that but it still changes the URL to http://owncloud.example.com:7777/owncloud/index.php/login instead of http://owncloud.example.com. Any other ideas ? – Devvix Nov 24 '16 at 14:45
  • Like I said, configure owncloud to think it's at the other address. – Walf Nov 25 '16 at 02:33
  • And how would i do that ? I dont see and option in the config files for that – Devvix Nov 25 '16 at 09:05
  • This any help? https://doc.owncloud.org/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html – Walf Nov 25 '16 at 11:03
  • Sorry about the lack of response but i do not have the time to look this week. Thanks for the suggestion and i will be sure to check it out and reply back. – Devvix Nov 28 '16 at 02:13
  • Ok, i know it took a long time to reply but im glad to say that it turned out that this worked :D. Thanks for sticking with me ! – Devvix Dec 08 '16 at 14:35