我想将www.myapp.com
转发给myapp.com
.
我目前的访问
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 规则的情况下添加此转发。
您必须先重定向:
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]