douzhaxian1267 2014-07-29 10:32
浏览 59

使用.htaccess将所有ASP重定向到Magento中的单个PHP页面

I am trying to redirect all the requests to .aspx pages in my Magento installation to a single PHP page that will handle a redirect.

My goal is to redirect every request of a .aspx page to migration-redirect.php and passing the original url/aspx page to the PHP page.

I am using the below code in the .htaccess file in the Magento 1.8 root dir to achieve this:

RewriteRule ^(.*)\.aspx$ /migration-redirect.php?ref=$1.aspx [NC,QSA]

pasted right above the RewriteRule .* index.php [L] code.

I have tried to paste the above code in different places of the standard Magento .htaccess file but it does not work. Each time i request for an .aspx page i get redirected to the 404 error page of Magento. I had already tried the above code on another server (without Magento) and it worked.

What am i missing? Thanks

  • 写回答

1条回答 默认 最新

  • duandu9260 2014-10-21 11:34
    关注

    Suppose your old website page is www.baseurl.com/icatalog/p.aspx and you want to redirect it to a new plain URL below will work like charm:

    RewriteRule ^icatalog/p\.aspx$ http://catalog.mcfeelys.com/s00178.htm [R=301,QSA,L]
    

    Kind note I have placed this for those who want have static PHP redirect from aspx page of older/unwanted website.

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效