【问题标题】:How to access root from subdomain如何从子域访问根
【发布时间】:2016-04-10 07:41:35
【问题描述】:

假设我的根文件夹(文件)中有我的 ErrorDocuments。

files
|
|----- .htaccess
|
|----- index.html
|
|----- 404.html
|
|----- 403.html
|
|----- ...
|
|
|----- abc ----- index.html
        |
        |------- .htaccess

我的文件/.htaccess

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

我的提供商会自动将portmann.one/abc 链接到abc.portmann.one。 但是,如果我的子域出现错误,我的404.html 不会显示,因为abc.portmann.one 的webroot 是portmann.one/abc 而不是portmann.one

如何配置我的网络空间,以便无需对我的域进行硬编码即可访问我的根目录。

【问题讨论】:

  • 也许通过 .htaccess?

标签: html .htaccess web


【解决方案1】:

您的 .htaccess 应该如下所示:

ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^403.html*$ portmann.one/403.html
RewriteRule ^404.html*$ portmann.one/404.html
RewriteRule ^405.html*$ portmann.one/405.html
RewriteRule ^500.html*$ portmann.one/500.html`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-25
    • 2013-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-13
    • 1970-01-01
    • 2017-01-31
    相关资源
    最近更新 更多