Magento:有趣的网址

use*_*429 1 linux apache ubuntu magento

我在Linux上安装了Magento,但URL看起来有点搞笑.例如,当我指向浏览器时http://localhost/magento/,URL会自动更改为http://localhost/magento/index.php/看起来很奇怪,因为index.php文件不是目录.然后,例如,当我点击购物车时,我被重定向到:http://localhost/magento/index.php/checkout/cart/

我只是想知道是否有人知道如何摆脱/index.php/浏览器地址栏中定义的URL 中的中间位?

end*_*ill 5

  1. 在Magento的管理面板中,将"使用Web服务器重写" (系统→配置→Web→搜索引擎优化)设置YES,将"使用安全URL前端" (系统→配置→Web→安全)设置YES.
  2. 确保启用Apache的重写mod sudo a2enmod rewrite && sudo service apache2 restart
  3. 将以下规则添加到.htaccessMagento根目录下的文件中:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /magento/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /magento/index.php [L]
    </IfModule>
    
    Run Code Online (Sandbox Code Playgroud)