在.htaccess文件中添加子域索引页

时间:2011-10-14 04:21:02

标签: php .htaccess zend-framework

我正在使用zend框架,我在web目录中有.htaccess文件,它重定向到public / index.php。 我的网站目录结构如下:

webroot/
   application/
      controllers/
      views/
         scripts/
   library/
   public/
     index.php     
   tests/
   .htaccess

我的.htaccess代码如下:

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]


RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]  

之后我创建了一个子域名,即“sub.mydomain.com”。

然后我的webroot目录如下:

webroot/
       sub/
       application/
          controllers/
          views/
             scripts/
       library/
       public/
         index.php     
       tests/
       .htaccess

当我打开然后错误信息来:

The requested URL /public/sub/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

当我删除上面的htaccess文件代码时,我的子域sub.mydomain.com已打开。 我想更改我的htaccess文件代码。其中我的域名或子域名都在运行....请帮助我......

0 个答案:

没有答案