1

I have a Magento installation and want to rewrite the url and remove index.php and the trailing '/' from it

e.g. rewrite http://www.domain.com/index.php/ to http://www.domain.com http://www.domain.com/index.php/customer/account/login/ to http://www.domain.com/customer/account/login

etc etc. So not for these 2 urls but for all urls.

I currently have this in my web.config:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration>
<system.webServer>
<rewrite>
<rules>
    <rule name="Magento SEO: remove index.php from URL">
    <match url="^(?!index.php)([^?#]*)(\\?([^#]*))?(#(.*))?" />
    <conditions>
    <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php/{R:0}" />
    </rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

With the above web.config, the urls do not seem to be rewritten at all, but are just kept as-is.

4

1 回答 1

4

根据我的建议,那件事帮不了你。

但是当我遇到问题时,您可以按照以下内容解决您的问题。

第1步:转到您的站点根文件夹,您可以在那里找到htaccess文件。在文本编辑器上打开它并找到#Rewrite Base/magento行。只需将其替换为Rewrite Base/

第 2 步:然后转到您的管理面板并启用重写(为使用 Web 服务器重写设置为是)。您可以在System->Configuration->Web->Search Engine Optimization.

第3步:然后转到缓存管理页面(系统缓存管理)并刷新您的缓存并刷新以检查站点。

希望这会帮助你。

于 2013-09-08T06:02:49.663 回答