Apache redirects

Hi,

I am trying to redirect a site to a new site but have a few issues:-

For example I want to redirect:
http://dev.example.com/page?Id=12345
to
http://dev.othersite.com:9011/page?param=12345

This is what I have configured in httpd.conf:-

RewriteEngine on
RewriteCond %{HTTP_HOST} dev.example.com [NC]
RewriteRule ^(.*)$ http://dev.othersite.com:9011/$1 [R=301,L]

TESTS
If I enter http://dev.example.com/ in the browser I get the Apache index.html page. I am not sure why?

If I enter http://dev.example.com/test in the browser I get page not found which I expect

If I enter http://dev.example.com/echo in the browser I get the expected page and the redirect works

If I enter http://dev.example.com/console in the browser I get "unable to connect" ... I expect that is because http://dev.othersite.com:9011/console returns a 403? Does that make sense?

Any help/pointers much appreciated! (I realise I haven't addressed the query_string yet but that can wait..)

Many thanks
simon

What happens if you try it like this?

RewriteEngine on
RewriteCond %{HTTP_HOST} dev.example.com [NC]
RewriteRule (.*)$ http://dev.othersite.com:9011/$1 [R=301,L]
1 Like

Thanks Neo. That resolved my problems!

---------- Post updated at 01:31 PM ---------- Previous update was at 01:25 PM ----------

One small issue which is not necessarily a problem, why do I get http://dev.othersite.com:9011//
or
http://dev.othersite.com:9011//console/
depending on the test?