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 trying to point subdomain.example.com to a resource on subdomain2.example.com/?page_id=1

It's a wordpress blog. I'm attempting to give a static page its own subdomain. The point is to basically showcase the existing resource without giving away the URL... So far, I've tried...

RewriteCond %{REQUEST_URI} subdomain.example.com [NC]

RewriteRule ^(.*)$ http://subdomain2.example.com/?page_id=1 [P]

but to no avail.

Currently I have the subdomain.example.com set up as its own Virtual server with a RedirectPermanent to the resource. Anyone have any insight on how to achieve this? I think i'm getting closer but I'm very new to this. Thanks.

share|improve this question
Did you also add RewriteEngine On? –  PP. Oct 18 '10 at 14:11
have you enabled mod_proxy? the [P] flag requires it. –  Marcel G Oct 18 '10 at 16:17

3 Answers 3

Also see http://wiki.apache.org/httpd/WhenNotToUseRewrite

share|improve this answer
Thanks for posting this link, I found a few cases there I've been guilty of in the past. There are several recipes on this page which solve the problem more simply. ProxyPass would do this, nyet? –  pjmorse Oct 19 '10 at 14:55
no, if I understand the problem correctly he always wants to redirect to the same static page, ProxyPass would always append anything after the given hostname to the end of the target and for that reason not always point to the same page. –  Marcel G Oct 19 '10 at 22:10

Your issue might be the flags you're using. See the documentation for the available flags; my guess is that you want [L] instead of [P].

I don't think an entire virtual server is needed for this, but YMMV.

share|improve this answer

RewriteEngine On is there, just forgot to include it.

Adding [L] still just rewrites the url to subdomain2.example.com/?page_id=1 instead of what i want to appear in the browser as subdomain.example.com

I was thinking about mimicking the virtualserver for subdomain2.example.com and then forcing the subdomain.example.com to point to one url, and truncating everything after the .com ?

A huge waste of a virtual server, but...how would I go about that ordeal?

share|improve this answer

Your Answer


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