WebFaction
Community site: login faq

Hi,

Suppose I have a site http://blog.domain.com/ and I want to also have it available as http://domain.com/blog/, but not by doing an external redirect -- I want the URL to remain http://domain.com/blog/*.

I have tried this rewrite rule: RewriteRule ^blog/(.*) http://blog.domain.com/$1 [P,L]

But this does not work. If I remove the P so that the flags parameter is just [L], this becomes an external redirect which is not what I want.

I have also tried ProxyPass /blog/ http://blog.domain.com/

But this causes an internal server error. I'm not sure if mod_proxy is available.

In this case http://domain.com is a PHP 5.2 application hosted on webfaction (that's where I'm editing .htaccess to add the rewrite rules) and http://blog.domain.com is a wordpress blog also hosted on webfaction.

Thanks.

asked 05 Aug '11, 16:13

adsgray
122
accept rate: 0%

mod_proxy is available - the reason you see the internal server error with ProxyPass is because ProxyPass cannot be used in .htaccess files.

Regarding your rewrite rule, when you say "this does not work", can you be more specific? What exactly do you see when you go to domain.com/blog with that rewrite in place?

(05 Aug '11, 17:23) seanf

Sorry for not being clearer. With that rewrite rule (RewriteRule ^blog/(.*) http://blog.domain.com/$1 [P,L]) I just end up getting the content of http://domain.com/.

eg. If I go to http://domain.com/blog/blah the URL stays the same but I get the content of http://domain.com/blah (in this case 404) instead of http://blog.domain.com/blah.

If I remove the P, I get an external redirect.

Thanks.

(05 Aug '11, 18:03) adsgray

Do you have RewriteEngine On in your .htaccess?

Is there some reason you want to do it this way, instead of just adding your blog app to your domain.com site on URL path /blog?

(05 Aug '11, 18:09) seanf

Yes, RewritEnging is on.

No particular reason for doing it this way, it was just the first thought.

Moving it to a sub-path of domain.com did the trick.

Thanks!

(05 Aug '11, 18:17) adsgray

You're very welcome!

(05 Aug '11, 18:20) seanf
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×73
×13
×5
×3

question asked: 05 Aug '11, 16:13

question was seen: 3,918 times

last updated: 05 Aug '11, 18:20

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM