English 中文(简体)
Apache - 子域重定向
原标题:Apache - Subdomain redirect

I m running a django application with fcgi
when I do this with one application, my .htaccess file looks like


    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.fcgi/$1 [QSA, L]

并且效果良好。

Now, I want to run different applications on different subdomains.
So I will create a *.fcgi file for every app.
Basically, what I want to do is to redirect the request to subdomain.mydomain.com to the subdomain.fcgi file.

我尝试过这个,但没有工作


    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ^(.*).mydomain.com$
    RewriteRule ^(.*)$ %1.fcgi/$1 [QSA, L]
问题回答

我已经解决了

Inside the public_http folder, I have one folder for every subdomain, Inside of each subdomain s folder, I have a dispatch.fcgi file. And the .htaccess file now is:


    Options +FollowSymLinks -Indexes 
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ^(.*).llulai.com$
    RewriteRule ^(.*)$ %1/dispatch.fcgi/$1 [QSA,L]

The downside, is that on the url.py file, the url patterns should start with


    r ^subdomain/$ 




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签