2017-10-12 5 views
2

www.myapp.commyapp.comに転送します。Django forward www.domain.comからfastcgi RewriteRule

私の現在のhtaccess

AddHandler fcgid-script .fcgi 
RewriteEngine on 
# Set up static content redirect: 
RewriteRule static/(.+)$ myapp-folder/public/static/$1 
# The following two lines are for FastCGI: 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ application.fcgi/$1 [QSA,L] 

私は上記の内容にラインの下に

RewriteCond %{HTTP_HOST} ^www.myapp.com$ [NC] 
RewriteRule ^(.*)$ http://myapp.com/ [R=301,L] 

を追加しようとしたが、それは私が欲しいの出力を与えるものではありません。 fastcgiがなければ、私のアプリはそれに依存しているので、これらの行を置き換えることができます。どのようにfcgiルールを削除せずにこの転送を追加することができますか?

+2

は – Croises

+0

@Croisesが、私は受け入れることができるように答えとしてそれを投稿(RewriteEngine on'の 'の後に)他の人の前に新しい行を追加します。 – silentprogrammer

答えて

0

あなたは最初にリダイレクトする必要があります。

AddHandler fcgid-script .fcgi 
RewriteEngine on 

# www.myapp.com to -> myapp.com 
RewriteCond %{HTTP_HOST} ^www\. [NC] 
RewriteRule^http://myapp.com%{REQUEST_URI} [NE,R=301,L] 

# Set up static content redirect: 
RewriteRule static/(.+)$ myapp-folder/public/static/$1 
# The following two lines are for FastCGI: 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ application.fcgi/$1 [QSA,L] 
関連する問題