【问题标题】:install cakephp with other website用其他网站安装 cakephp
【发布时间】:2013-08-08 14:53:59
【问题描述】:

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

SPIP => /var/www/vitrine/

cakephp => /var/www/client/

client.<url>.eu 可以访问 cakephp 网站,但是当我访问该地址时,出现 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>

谢谢:)

【问题讨论】:

  • 提问时请使用真实的路径/名称,不要匿名化。它只会使问题更难解决。例如,您在问题的顶部谈论/var/www/metier,但在您的配置中有/var/www/client。这太混乱了!这可能是您的问题,也可能是匿名的,但我们无法判断。请粘贴您的真实路径和配置!
  • 抱歉打错了。配置文件是正确的,它是/var/www/client。

标签: .htaccess cakephp


【解决方案1】:

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

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

这样对我有用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-04
    • 2015-04-13
    • 1970-01-01
    • 2015-12-13
    • 1970-01-01
    相关资源
    最近更新 更多