dozr162106 2016-03-28 23:46
浏览 48
已采纳

.htaccess图像重定向(不同目录)

Can somebody help me with an image redirect in .htaccess? I need to replace http://www.example.com/wp/folder_changes/6/bg6.png with http://www.example.com/wp/wp-content/uploads/folder_changes/bg6.png The '6' can be any number and any length.

I only have some regular expression experience and came up with this:

\/wp\/(.*)\/(.*)\/bg(\d*).png$

How do you re-assemble it again?

RewriteEngine On
RewriteRule /wp/(.*)/(.*)/bg(\d*).png$ /wp/wp-content/uploads/???/bg???.png

Thanks!

  • 写回答

1条回答 默认 最新

  • dongli8466 2016-03-28 23:50
    关注

    I believe you want:

    RewriteRule wp/(.*)/(.*)/bg(\d*).png$ /wp/wp-content/uploads/$1/bg$3.png
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 搭建awx,试了很多版本都有错
  • ¥15 java corba的客户端该如何指定使用本地某个固定IP去连接服务端?
  • ¥15 activiti工作流问题,求解答
  • ¥15 有人写过RPA后台管理系统么?
  • ¥15 Bioage计算生物学年龄
  • ¥20 如何将FPGA Alveo U50恢复原来出厂设置哇?
  • ¥50 cocos2d-x lua 在mac上接入lua protobuf?
  • ¥15 es 7.17.20版本生成时间戳
  • ¥15 wpf dategrid表头排序图标自定义
  • ¥15 xshell无法连接提示ssh服务器拒绝密码