繁体   English   中英

magento内页不起作用,重定向到404页?

[英]magento inner page not working , redirect to 404 page?

magento内部页面(类别链接,产品页面等)不起作用,重定向到404页面? 只有主页有效。

我的链接是

http://localhost/magento/men.html
http://localhost/magento/men/new-arrivals.html
http://localhost/magento/tori-tank-586.html

在管理员

  • 使用Web服务器重写->是
  • 在前端使用安全URL->是

以下是我的.htaccess文件

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /magento/

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

如果您能够访问内部页面,例如http://localhost/magento/index.php/men/new-arrivals.html 如果是,则尝试启用apache重写模块,然后重新启动服务器并再次检查。

用一个全新的默认安装替换.htaccess。 清除缓存和会话。 你已准备好出发...!

我找到了解决方案。

打开此文件/ etc / apache2 / site-available / default

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

另外,还需要上述更改。

/etc/apache2/apache2.conf

<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>

重新启动Apache

sudo服务apache2重新启动

更换RewriteBase /magento/RewriteBase /您的htaccess文件。 并清除缓存。

在本地服务器上,请根据所附的屏幕截图启用rewrite_module。 希望它能解决您的问题。 http://i.stack.imgur.com/M2ix2.jpg

这件事也发生在我身上。 可能有2个问题:

1)您的服务器未授予您mod_rewrite访问权限。 为此,只需转到服务器安装(如果在本地),然后在apache中然后选择conf(用于xampp)。 在那里您将找到一个httpd文件。 在其中找到“ LoadModule rewrite_module modules / mod_rewrite.so ”。 这可能会改变,具体取决于您的php版本。 如果已注释,则取消注释(通过删除#)。 如果已经取消注释,这不是问题。

2)现在您没有htaccess文件,因为在某些情况下,它在git repo中处于忽略状态。 因此,只需转到magento的工作文件夹,然后将所有.htaccess文件复制粘贴到新文件夹中即可。 重新启动服务器,它将正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM