开发者

How do I install WordPress in a Django subdirectory?

开发者 https://www.devze.com 2023-01-05 02:02 出处:网络
I hav开发者_JAVA百科e Django set up on my server at http://stevencampbell.org/ I want to be able to run WordPress at stevencampbell.org/blog/

I hav开发者_JAVA百科e 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.


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消