如何自动生成Magento URL重写



我已经为我正在进行的项目调整了Ebizmarts Customerprofile模块,我需要自动将任何请求重写为:

mymagestore.com/profile/USERNAME 

mymagestore.com/customerprofile/account/view/username/USERNAME

听起来很简单,但这些是我正在考虑的选项。过去有人这样做过吗?如果有,你是如何做到的?

  1. .htaccess重写规则(con:Magento外部)
  2. 自定义Magento索引过程以创建Magento URL重写(专业:在Magento内,这将是进行其他清理的好时机,专业:更多工作)
  3. 观察Customer对象何时被保存并创建URL Rewrite(pro:在Magento中,con:可能会留下孤立的行,并且可能无法升级)

感谢您抽出时间,Wilson

Zachary说得好。对于任何正在寻找的人来说,我发现,做一个自定义Magento重写规则的唯一方法是使用带有P标志的mod_proxy。

RewriteRule ^profile/(.*)$ /customerprofile/account/view/username/$1 [P]

详细信息:

http://httpd.apache.org/docs/current/rewrite/flags.html#flag_p

最新更新