我想将www.myapp.com
转发给myapp.com
。
我目前的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规则的情况下添加此转发。
答案 0 :(得分: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]