首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用htaccess的Miltiple域/子域

使用htaccess的Miltiple域/子域
EN

Stack Overflow用户
提问于 2015-10-22 08:57:59
回答 1查看 82关注 0票数 2

我的网站有document ~/public_html,我正在尝试使用htaccess组织多域/子域重定向。

可能的重定向逻辑:如果找到域/子域目录-执行重定向,否则抛出404错误。

可能的目录结构:

代码语言:javascript
复制
public_html/
            .htaccess (main redirect router)
public_html/
            domain-1/
                    application/
                    public_html/
                                .htaccess
public_html/
            domain-2/
                    application/
                    public_html/
                                .htaccess
public_html/
            domain-3/
                    application/
                    public_html/
                                .htaccess
public_html/
            subdomain-1.domain-1/
                                application/
                                public_html/
                                            .htaccess
public_html/
            subdomain-2.domain-1/
                                application/
                                public_html/
                                            .htaccess

非常感谢你的帮助。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2015-10-22 14:34:02

您的.htaccess文件应该有

代码语言:javascript
复制
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain.domain.in [NC]
RewriteRule ^(.*)$ http://www.hardikvyas.in/$1 [L,R=301]

RedirectMatch ^/$ /redirection directory name/

尝尝这个。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33277100

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档