代码之家  ›  专栏  ›  技术社区  ›  lock

如何将www.domain.com重写为另一个域的/www/domain.com/index.php?

  •  -1
  • lock  · 技术社区  · 15 年前

    我现在在我的htaccess上有这个:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/www/
    RewriteRule (.*) /www/$1/index.php
    

    但我一直都有一个错误页面

    我想做的是为客户机注册很多域 只需将他们所有网站的文件存储在我域的www文件夹中名为“their domain.com”的文件夹中。

    1 回复  |  直到 15 年前
        1
  •  0
  •   RobertPitt    15 年前

    首先,您将永远无法在URI中找到www,因为URI是index.php之后的所有内容?那么这个URI将是index.php? /这里/is/the.uri/string

    我会看一下http_主机

    <IfModule mod_rewrite.c>
       RewriteCond %{HTTP_HOST} !^first-host.com$ [NC]
       RewriteRule ^(.*)$ http://new-host.com/$1 [L,R=301] #Send 301 so search engines know where to go.
    </IfModule>
    
    推荐文章