In htaccess, I'd like to replace underscores with hyphens and then redirect the user the new url

后端 未结 2 428
野性不改
野性不改 2020-12-06 18:32

I\'d like to redirect any request that contains underscores to the same url, but with hyphens replacing the urls. I\'ve seen a lot of forums suggest I do something like this

2条回答
  •  攒了一身酷
    2020-12-06 19:02

    See the "Next" directive/rewrite flag, which causes the ruleset to be reevaluated starting with the first rule: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_n

    Something like this might work:

    RewriteRule (.*)_(.*) $1-$2 [N] 
    

提交回复
热议问题