Apache redirects


 
Thread Tools Search this Thread
Top Forums Web Development Apache redirects
# 1  
Old 02-06-2015
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:-


Code:
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
# 2  
Old 02-06-2015
What happens if you try it like this?

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

This User Gave Thanks to Neo For This Post:
# 3  
Old 02-06-2015
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Web Development

302 Redirects Issues Effected Google Search Console (GSC) Fixed - DBSEO Goto Rewrite Problems Solved

Finally! Yesterday I FINALLY figured out why Google Search Console (GSE) was showing so many pages with 302 redirects in our link budget. For over a year, I thought this issue was relate to either Apache2 or DBSEO (our PHP module which rewrites our links to be SEO friendly). However, when I... (5 Replies)
Discussion started by: Neo
5 Replies

2. Red Hat

Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-la

Have no idea on what the below error message is: Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -buildfile build.xml dist. Any help? (3 Replies)
Discussion started by: gull05
3 Replies

3. Web Development

Apache module development on apache 2.2

Hi, I'm new to developing modules for Apache. I understand the basics now and can develop something simple which allows a 'GET' request to happen, but what I want to do is actually 'POST' information to my site. I know the basic POST Request works and I can see that it is post by looking at... (2 Replies)
Discussion started by: fishman2001
2 Replies

4. Shell Programming and Scripting

Apache Help..

I have properly installed Apache server 2.0 on Linux redhat9 and its working fine and showing its test page from LAN Computers. Now i want to change the directory of apache so it can show my webpages. Can anyone tell me where i can do that ????? Please help in detail because i am facing... (1 Reply)
Discussion started by: wakhan
1 Replies

5. IP Networking

Apache

I want to have multiple domains to be configured in apache web server on redhat linux can i have that without DNS server configured. What all i have to do for that.What all to configure ? And importantly i want the site be accessed by name rather IP address. Please help me ... (1 Reply)
Discussion started by: Vijayanand
1 Replies
Login or Register to Ask a Question