magento内页(类别链接,产品页面等等)不能正常工作,重定向到404页面?只有主页正在运作。
我的链接
http://localhost/magento/men.html
http://localhost/magento/men/new-arrivals.html
http://localhost/magento/tori-tank-586.html
在管理员
下面是我的.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>
答案 0 :(得分:2)
如果您能够访问http://localhost/magento/index.php/men/new-arrivals.html
之类的内部网页。如果是,则尝试启用apache重写模块,然后重新启动服务器并再次检查。
答案 1 :(得分:1)
将.htaccess替换为默认安装.htaccess。 清除缓存和会话。你很高兴......!
答案 2 :(得分:1)
我找到了解决方案。
打开此文件 的/ etc / apache2的/位点/有默认
<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 service apache2 restart
答案 3 :(得分:0)
将RewriteBase /magento/
替换为htaccess文件中的RewriteBase /
。并清除缓存。
答案 4 :(得分:0)
在本地服务器上,请根据附带的屏幕截图启用rewrite_module。希望它能解决你的问题。 http://i.stack.imgur.com/M2ix2.jpg