0

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.

  1. 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?

  2. 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 ).

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to add Redirect at the end of the directive:

RewriteRule ^service$ http://www.mydomain.com:PORT [R]

Play with the regex to get it working though. :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.