htaccess rewrite rule for a part of URL

淺唱寂寞╮ 提交于 2019-12-24 11:17:44

问题


I try to change over htaccess from

http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic.jpg

to

http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic1.jpg

Here is my rules

RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule nopic\.jpg$ nopic1\.jpg

It works in some way;) The whole URL will be changed just to "nopic1.jpg".

The question is: How can I change only the last part of URL?


回答1:


This should work:

RewriteRule ^(.*)nopic\.jpg$ $1nopic1\.jpg


来源:https://stackoverflow.com/questions/10106561/htaccess-rewrite-rule-for-a-part-of-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!