Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess mod在别名文件夹中重写不起作用_.htaccess_Mod Rewrite_Alias - Fatal编程技术网

.htaccess htaccess mod在别名文件夹中重写不起作用

.htaccess htaccess mod在别名文件夹中重写不起作用,.htaccess,mod-rewrite,alias,.htaccess,Mod Rewrite,Alias,我在Drupal中有一个网站“new.mysite.com”。 在vhost文件中,我有一个目录“weight-loss”,指向该网站服务器上的另一个位置。 在那个文件夹中,我有一个基于Zend Framework的小型站点,它使用mod_rewrite。 mod_重写不起作用,我认为这是因为这个文件夹是一个别名,因为完全相同的迷你站点在另一个位置工作,而不在别名文件夹中。 迷你网站位于“/home/weight-loss/admin/”中。.htaccess文件为“/home/weight-l

我在Drupal中有一个网站“new.mysite.com”。 在vhost文件中,我有一个目录“weight-loss”,指向该网站服务器上的另一个位置。 在那个文件夹中,我有一个基于Zend Framework的小型站点,它使用mod_rewrite。 mod_重写不起作用,我认为这是因为这个文件夹是一个别名,因为完全相同的迷你站点在另一个位置工作,而不在别名文件夹中。 迷你网站位于“/home/weight-loss/admin/”中。.htaccess文件为“/home/weight-loss/admin/.htaccess”

应该是:

我做错了什么

vhost设置

<VirtualHost 192.168.100.142:80>
    ServerAdmin serveradmin@bbgi.com
    DocumentRoot /home/drupal_1
    ServerName new.mysite.com
    ServerAlias mysite.com www.mysite.com
    Alias /weight-loss /home/weight-loss/
    ErrorLog /var/log/httpd/mysite.com_err_log
      CustomLog /var/log/httpd/mysite.com_log special
    <Directory /home/drupal_1>
      Options FollowSymLinks Includes ExecCGI
              AllowOverride All
              DirectoryIndex index.html index.htm index.php
    </Directory>
</VirtualHost>

复制
..
并将
/home/drupal_1
更改为
/home/weight-loss
。这将启用htaccess(因此也可以进行mod_rewrite)

非常感谢Gerben。这就是答案!
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /weight-loss/admin/index.php [NC,L]