Search code examples
phppythondjango.htaccessfastcgi

How to serve PHP together with Django?


i have a Bluehost hosting account, and i manually configure django with this tutorial, but now i need to run php scripts into a subdomain or in subfolder, how can i do that? my root .htaccess look like this

AddHandler fcgid-script .fcgi
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(django\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ django.fcgi/$1 [L]

Thanks!


Solution

  • I got it, just change a little htaccess and ready, stay this way for those who have the same problem:

    AddHandler fcgid-script .fcgi
    AddHandler application/x-httpd-php5s .php
    # For security reasons, Option followsymlinks cannot be overridden.
    #Options +FollowSymLinks
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(subfolder/.*)$ - [L]
    RewriteRule ^(media/.*)$ - [L]
    RewriteRule ^(django\.fcgi/.*)$ - [L]
    RewriteRule ^(.*)$ django.fcgi/$1 [L]
    

    Thanks!