htaccess redirect with on rule

放肆的年华 提交于 2019-12-24 17:18:58

问题


how to write one rule what would satisfy all this redirect what I try to achive with the following rules

RewriteRule ^desktop/page/1/ /tag/desktop/page/1/ [R,L]
RewriteRule ^desktop/page/2/ /tag/desktop/page/2/ [R,L]
RewriteRule ^desktop/page/3/ /tag/desktop/page/3/ [R,L]
RewriteRule ^desktop /tag/desktop [R,L]

the last one is never executed


回答1:


Try:

RewriteRule ^desktop(/.*)?$ /tag/desktop$1 [R,L]

Or if you must limit it to page/number:

RewriteRule ^desktop(/(page/[0-9]+/?)?)?$ /tag/desktop$1 [R,L]


来源:https://stackoverflow.com/questions/12686839/htaccess-redirect-with-on-rule

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