views:

56

answers:

2

I have Django set up on my server at http://stevencampbell.org/

I want to be able to run WordPress at stevencampbell.org/blog/

I'm running all my Python and Django files through Fast_CGI (only Django option on my server). My .htaccess file looks like this:

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^(/media.*)$ /$1 [QSA,PT]
RewriteRule ^(/adminmedia.*)$ /$1 [QSA, PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]

Assumedly, I need to add another RewriteRule in for the blog directory, but none of my attempts so far have worked. I can access /blog/index.php, but /blog/ gives me a Django error, meaning that the directory is still be processed by the dispatch.fcgi file.

Also, I'm not really sure what I'm doing with these rewrite rules. Let me know if I'm doing anything else wrong.

A: 

This sounds a little awkward. I don't know enough about mod_rewrite to get check your settings but why don't you simply use a Django based blogging engine instead of wordpress. Something like http://github.com/nathanborror/django-basic-apps perhaps?

Noufal Ibrahim
Yeah, I've heard of Django Basic Apps, and tried it out. I'm just very, very familiar with WordPress, and would prefer to continue exercising that knowledge rather than let it disappear.
Desmond
+1  A: 
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^(/media.*)$ /$1 [QSA,PT]
RewriteRule ^(/adminmedia.*)$ /$1 [QSA, PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/blog(/.*)?$
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]

See that extra RewriteCond? Basically says "if the request is not /blog or /blog/whatever, then rewrite requests to dispatch.fcgi

In your WordPress .htaccess inside /blog, you should add the line RewriteBase /blog/ right after the RewriteEngine On statement.

TheDeadMedic
Thank you! Now I need to decide whether to go with Django, or use WordPress. I'm leaning towards WordPress.
Desmond