Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top