path string wise match redirection in htaccess

本小妞迷上赌 提交于 2020-01-17 10:28:17

问题


How to redirect the path using string compare.

For example: We have path like (1000+ redirections)

www.example.com/kb-123
www.example.com/kb-555
www.example.com/kb-666

Now using single rule how to redirect all above path's into below path's?

www.example.com/article/kb-123
www.example.com/article/kb-555
www.example.com/article/kb-666

回答1:


Try with below rule,

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.+)
RewriteRule ^ /article/%1 [R=301,L]


来源:https://stackoverflow.com/questions/44269702/path-string-wise-match-redirection-in-htaccess

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