I'd like to redirect http://www.mydomain.com/service
to http://www.mydomain.com:PORT
where PORT
is the port of the service which will serve the pages.
Is it possible given it's apache which is listening on port 80
so which will perform the redirection, and it's an unrelated service which is listening on PORT
?
What's the syntax? I tried stuff like:
RewriteRule ^service$ http://www.mydomain.com:PORT
but I only get a 500
internal server error.
Thanks for helping.
EDIT:
As Vinko suggested there is some helpful line in the error log:
[alert] [client 192.168.1.4] /path/to/the/site/root/.htaccess:
Invalid command 'Option', perhaps misspelled or defined by a module not
included in the server configuration
Which came from the line:
Option +FollowSymlinks
Now it works, but... the address changes, and I'd like it not to. I'd like to have the same behavior than with a classic redirection, where the address change is transparent (e.g. mydomain.com/service > mydomain.com/?var=service
).
The 500 error points out to not having mod_rewrite enabled. Check the error log to test the theory and, if correct, load the module in your configuration.
If incorrect, edit the question with the error in the log. Every 500 error has a corresponding line in the error log.