与Godaddy的真正子域名

时间:2013-06-30 22:40:02

标签: php .htaccess redirect lamp

我的.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^deathga.me$ [NC]
RewriteRule ^(.*)$ http://deathga.me/$1 [L,R=301]
</IfModule>

它正确地从www.deathga.me重定向到deathga.me,它解决了许多问题。但它也将play.deathga.me重定向到deathga.me/play/,这是不可取的。

我的问题基本上与此相反:Redirecting http://example.com to http:/www.example.com while keeping http://subdomain.example.com access intact。只有我无法弄清楚如何将它应用到我的网站,甚至查看该问题,谷歌搜索和尝试很多事情。问题本身很简单:如何将www.example.com重定向到example.com但将sub.example.com保留在该子目录中?我甚至不确定Godaddy是否存在问题或者htaccess ......我应该从哪里开始研究?这是Godaddy子域配置的截图:

view of the subdomain

编辑:现在已全部.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} !^play.deathga.me$ [NC] 
RewriteCond %{HTTP_HOST} !^deathga.me$ [NC]
RewriteRule ^(.*)$ http://deathga.me/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

2 个答案:

答案 0 :(得分:2)

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 
RewriteCond %{HTTP_HOST} !^play.deathga.me$ [NC] 
RewriteCond %{HTTP_HOST} !^deathga.me$ [NC] 
RewriteRule ^(.*)$ http://deathga.me/$1 [L,R=301] 
</IfModule>

答案 1 :(得分:0)

显然,我想做的事情不能用'假'godaddy子域名和经济帐户:Setting up a "real" subdomain with Go Daddy

感谢@borazslo的所有帮助。