【问题标题】:how do i rewrite www.domain.com to another domain's /www/domain.com/index.php?我如何将 www.domain.com 重写为另一个域的 /www/domain.com/index.php?
【发布时间】:2010-06-30 15:36:33
【问题描述】:

我的 htaccess 目前有这个:

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

但我不断收到错误页面

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

【问题讨论】:

    标签: mod-rewrite


    【解决方案1】:

    首先,您永远不会在 URI 中找到 www,因为 URI 是 index.php 之后的所有内容?所以 uri 将是 index.php?/here/is/the.uri/string

    我会查看 HTTP_HOST

    <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>
    

    【讨论】:

    • 我不确定我是否理解你。查询字符串跟在 ?在参数列表中。 foo=bar&bar=foo
    • 例如这个 htaccess 在 www.mydomain.com 上的域。我们有一个人我们注册为someone.com并将他们的dns转发到www.mydomain.com,现在htaccess应该指向mydomain.com/www/someone.com/index.php这可能吗?
    • 我非常怀疑这是否可以通过 htaccess 实现,您需要在服务器上设置 DNS 记录以指向特定用户,因此 theredomain.com 将指向 /server/domains/theredomain。 com/public_html/ 我在服务器和 dns 方面不是最好的,但我相信这样的方法是需要的
    猜你喜欢
    • 1970-01-01
    • 2013-10-10
    • 2013-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多