Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to host a wordpress blog from a domain pointed to an app hosted with google app engine?

I have a Python web app hosted with Google App Engine with a .com pointed towards the App Engine app. I would like to start a Wordpress blog at mydomain.com/blog. Since Wordpress runs on PHP, I reckon it would be easier to host the Wordpress blog on my other web host account with cpanel and change some domain pointer. What is the best way to achieve this?

I suppose setting a DNS A Name record for 'blog' to point to my other web host account will create blog.mydomain.com and solve this. But is there a way to have mydomain.com/blog pointed to the other web hosting account with the Wordpress blog? Thank you.

like image 603
bobbyong Avatar asked Aug 17 '12 20:08

bobbyong


2 Answers

Another approach similar to renab's: on your Wordpress box you can configure the Apache (or any other sensible http server) to work as a proxy in front of your App Engine application for every URL but the /blog one (which would be served directly).

You could also enable some level of caching on the Apache server and save a little on processing costs.

like image 107
rbanffy Avatar answered Sep 24 '22 18:09

rbanffy


A simple solution may be to create the A record you mentioned in your question then put an index.html in the blog/ directory on app engine that contains

window.location = "http://blog.mydomain.com"

as the onload function of the body tag.

Another solution is adding a .htaccess file which redirects http://www.mydomain.com/blog to http://blog.mydomain.com.

Edit: As mentioned in the comment below, appengine does not support this method. I am leaving it in for the off chance that it will help someone who has a similar question not related to app engine.

A similar redirect would be needed for the domain without www in front of it.

Edit for better htaccess example:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$
RewriteRule ^blog/(.*) http://blog.mydomain.com/$1 [R=301,L]

You will have to check my htaccess syntax, its been a while since I had to write rewrite rules, and I don't have a webserver handy to test it

like image 37
renab Avatar answered Sep 23 '22 18:09

renab