Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm running Apache 2.2 with WHM / cPanel. Let me know what other info you need to answer this question.

I want to set up some kind of forwarding/redirect so that the following occurs:

_http://appname.mydomain.com/ (ignore the underscore, couldn't post actual links)

actually sends you to


This can be overt (your browser address bar changes) or not, it doesn't really matter (although if I get to pick I would prefer the address bar NOT change).

My initial thought was to use a CNAME, but I've since learned you can't include a port in your cname. Now I'm thinking I have to do something with my Apache VHOST?

I am very much a novice at apache / web server internal workings, but I know my way around a command line well enough.

share|improve this question

2 Answers 2

Perhaps you could use mod_proxy? Something like this in your virtual host configuration should do the trick (not tested)

<VirtualHost appname.mydomain.com>
    ProxyPass / http://mydomain.com:8072/appname/

Make sure to read the docs as I haven't used it myself.

share|improve this answer
If you do use the Proxy module, learn from my mistake. DO NOT ENABLE ProxyRequests (ie set it to "On"). You will turn into a HTTP proxy. The documentation says your server could be used to send email, which is very misleading as it can do a whole lot more than just that. –  Nathan Adams Jun 5 '10 at 23:08

Is there any reason you can't have a redirect page sitting on http://appname.mydomain.com bouncing you to the new page?

(Untested) example in PHP, since I'm a PHP type of guy.

<?php header('Location: http://newurl:newport'); ?>

share|improve this answer
Hmmm OK, my chunk of code doesn't want to be displayed :/ (presumably from lack of backticks) –  Ben Pilbrow Jun 5 '10 at 22:17
You're missing a Location: in that header, so it would be header('Location: newurl:newport'); –  kaerast Jun 5 '10 at 22:52
Arg so I was (updated) - I did that in my head, honest! iPhones weren't designed for this!! –  Ben Pilbrow Jun 5 '10 at 22:55
It's a better idea to use proxypass to make it seamless, or a redirect (mod_rewrite or mod_redirect) so users get the 301 moved. SEO generally likes this better anyway, if you're worried about that at all. –  Chris S Jun 6 '10 at 2:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.