【问题标题】:Magento 404 on Sub Pages子页面上的 Magento 404
【发布时间】:2013-10-15 17:55:12
【问题描述】:

我刚刚在 ubuntu 上运行 apache2 的另一台服务器上恢复了我们的 Magento 网站。主页可以正常显示,但如果我尝试转到任何其他页面,我会收到 404。

权限

  • 所有文件都是660
  • 所有目录都是770所有文件和目录
  • 所有文件和目录都属于 www-data 组

我尝试过的事情

  • 检查所有网站和商店ID
  • 在域和页面路径之间添加/index.php/
  • 清除临时文件

除了 access.log 和 error.log 中的标准 404 行之外,日志文件中没有任何内容。

apache2 .conf 文件

<VirtualHost *:80>
    ServerAdmin serveradmin@mydomain.com
    ServerName mydomain.com

    DocumentRoot "/var/www/default/"
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory "/var/www/default/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        php_admin_flag engine on
        php_admin_value open_basedir none
    </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>

.htaccess

DirectoryIndex index.php

<IfModule mod_php5.c>
    php_value memory_limit 10G
    php_value max_execution_time 1800000
    php_flag magic_quotes_gpc off
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
    php_flag zend.ze1_compatibility_mode Off
</IfModule>

<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>
</IfModule>

<IfModule mod_ssl.c>
    SSLOptions StdEnvVars
</IfModule>

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>

AddDefaultCharset Off

<IfModule mod_expires.c>
    ExpiresDefault "access plus 1 year"
</IfModule>

Order allow,deny
Allow from all

<Files RELEASE_NOTES.txt>
    order allow,deny
    deny from all
</Files>

日志文件输出

==> /var/log/apache2/oem1-error.log <==
[Tue Oct 15 12:32:21 2013] [error] [client 192.168.0.4] File does not exist: /var/www/gearhead_oem1/admin

==> /var/log/apache2/oem1-access.log <==
192.168.0.4 - - [15/Oct/2013:12:32:21 -0600] "GET /admin HTTP/1.1" 404 507 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36"

【问题讨论】:

  • 检查您的 .htaccess 文件。可能是您在旧服务器上部署时修改了该文件..如果可能的话,请您在此处发布您的 .htaccess 代码..?以及您的日志文件..
  • 尝试将您的 .htaccess 恢复到 Magento 附带的那个。先看看是否有效。
  • @Axel 好主意。也不行。
  • 您是否尝试过在System &gt; Configuration &gt; Web &gt; Search Engine Optimizations 下禁用Use Web Server Rewrites 并查看URL 是否有效?您还确定为 Apache 启用了 mod_rewrite 吗?

标签: magento ubuntu configuration apache2 http-status-code-404


【解决方案1】:

听起来像是重写的问题。在 Ubuntu 中:

运行:

a2enmod rewrite

然后:

service apache2 restart

mod_rewrite 现在将启用!

【讨论】:

  • 我还在您的答案中添加了 php5-curl。 a2enmod rewrite 让我顺利完成了大部分任务,但我仍然遇到一些 curl 错误。
猜你喜欢
  • 1970-01-01
  • 2015-05-31
  • 2012-12-27
  • 1970-01-01
  • 1970-01-01
  • 2012-03-29
  • 1970-01-01
  • 1970-01-01
  • 2011-09-28
相关资源
最近更新 更多