Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: mod-proxy and permanent redirect |
|
Author |
|
BLuFeNiX
Joined: 21 Sep 2012 Posts: 4
|
Posted: Fri 21 Sep '12 16:26 Post subject: mod-proxy and permanent redirect |
|
|
Hello everyone!
I have an apache22 server hosting several domains (we'll call one of them "example.com"). I also have a local wiki server running on 172.30.1.20:5999. I would like to access the wiki from wiki.example.com. My virtual host here accomplishes most of what I want to do, however, there is an issue. The wiki needs a specific path to load correctly (http://wiki.example.com/companyname/wiki). So, when I go to http://wiki.example.com/ I get "page not found", but if I go to http://wiki.example.com/companyname/wiki I get the correct content. I would like http://wiki.example.com/ to redirect to http://wiki.example.com/companyname/wiki, so that no one has to remember or type the full URL. I tried to add a permanent redirect, but after a few seconds of loading the page I get this in my address bar: "http://wiki.example.com/companyname/wikicompanyname/wikicompanyname/wikicomp-nyname/wikicompanyname/wikicompanyname/wikicompanyname/..."
What do I need to so to preserve my proxy, and redirect the URL correctly?
Thanks!
Code: |
<VirtualHost *:80>
ServerName wiki.example.com
ServerAlias wiki.example.com
ProxyPass / http://172.30.1.20:5999/
ProxyPassReverse / http://172.30.1.20:5999/
<Proxy *>
Order deny,allow
Deny from all
Allow from 172.30.1.0/24
</Proxy>
</VirtualHost>
|
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Sat 22 Sep '12 22:57 Post subject: |
|
|
Not tested, but I would try
Code: |
<Location />
Redirect permanent / http://wiki.example.com/companyname/wiki
</location>
|
|
|
Back to top |
|
BLuFeNiX
Joined: 21 Sep 2012 Posts: 4
|
Posted: Mon 24 Sep '12 8:22 Post subject: |
|
|
James Blond wrote: | Not tested, but I would try
Code: |
<Location />
Redirect permanent / http://wiki.example.com/companyname/wiki
</location>
|
|
Thanks for the reply, however, this did not work. After doing some more searching I think I may need mod_rewrite, but I don't know how to use it. Everything I come up with either has a syntax error or just doesn't seem to do anything. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 25 Sep '12 14:30 Post subject: |
|
|
This I've tested
Code: |
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/company/wiki/
RewriteRule (.*) company/wiki/$1 [R=301,L]
|
|
|
Back to top |
|
BLuFeNiX
Joined: 21 Sep 2012 Posts: 4
|
Posted: Tue 25 Sep '12 21:11 Post subject: |
|
|
James Blond wrote: | This I've tested
Code: |
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/company/wiki/
RewriteRule (.*) company/wiki/$1 [R=301,L]
|
|
This worked beautifully, thank you! |
|
Back to top |
|
|
|
|
|
|