Apache URL rewrite for subdomain pointing to an existing virtual server resource?

Posted on

Apache URL rewrite for subdomain pointing to an existing virtual server resource? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, mod-rewrite, rewrite, mod-alias, .

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 ^(.*)$

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.

Solution :

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

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.

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?

Leave a Reply

Your email address will not be published.