0

我有一台网络服务器。我想在这台服务器上运行 2 个网站。1 个带有 SPIP 的网站(已经运行良好)和 1 个带有 cakephp 的网站(有问题)。

SPIP => /var/www/vitrine/

cakephp => /var/www/client/

cakephp 网站可以通过client.<url>.eu但是当我去这个地址时,我有一个 404 错误。你能告诉我为什么吗?

这是我的 /etc/apache2/sites-available/default :

<VirtualHost *:80>
  ServerAdmin webmaster@localhost

  DocumentRoot /var/www/vitrine
  ServerName <url>.eu
  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>
  <Directory /var/www/vitrine>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>

  DocumentRoot /var/www/client/app/webroot
  ServerName client.<url>.eu
  <Directory /var/www/client>
    Options Indexes FollowSymlinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

</VirtualHost>

这里 /var/www/client/app/.htaccess :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

这里 /var/www/client/app/webroot/.htaccess :

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

谢谢 :)

4

1 回答 1

0

在 /var/www/client 创建一个 .htaccess 文件,内容如下:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]
</IfModule>

它对我有用

于 2013-08-08T16:24:49.120 回答