【问题标题】:SubDomain not work with .htaccess子域不适用于 .htaccess
【发布时间】:2017-06-09 08:28:23
【问题描述】:

主域名: www.kientrucht.com

文件夹: public_html/

文件:index.php

文件 htaccess:public_html/.htaccess

RewriteEngine on
Options -Indexes
DirectoryIndex index.php 

RewriteRule ^admin/$ admin/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?com=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html/$ index.php?com=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html/p=([0-9]+)$ index.php?com=$1&p=$2 [L]

RewriteRule ^([a-zA-Z0-9_-]+).html/keyword=(.*)/p=([0-9]+)$ index.php?com=$1&keyword=$2&p=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html/keyword=(.*)/$ index.php?com=$1&keyword=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html/keyword=(.*)$ index.php?com=$1&keyword=$2 [L]

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?com=$1&lang=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)-([0-9]+).html$ index.php?com=$1&id=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?com=$1&idl=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/p=([0-9]+)$ index.php?com=$1&idl=$2&p=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/p=([0-9]+)$ index.php?com=$1&idl=$2&idcat=$3&p=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?com=$1&idl=$2&idcat=$3 [L]

RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?com=san-pham&idl=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/&p=([0-9]+)$ index.php?com=san-pham&idl=$1&p=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html/p=([0-9]+)$ index.php?com=san-pham&idl=$1&idcat=$2&p=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ index.php?com=san-pham&idl=$1&idcat=$2 [L]

子域: beta.kientrucht.com

文件夹: public_html/_beta

文件:public_html/_beta/index.html

无法访问子域!自动识别为 MainDomain(在 public_html/不是 public_html/_beta/ 上的 kientrucht.com)!

如何编辑当前 public_html/.htaccess 文件以使子域上的任何文件和路径正常工作?

【问题讨论】:

    标签: .htaccess mod-rewrite url-rewriting


    【解决方案1】:

    .htaccess 文件通常在子目录中继承。

    您必须在 _beta 文件夹中创建一个新的 .htaccess 文件,并在 _beta/index.html 上进行重定向。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-12
      • 2020-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多