开发者

how to check $1 and $2 subpatern exists or not in htacess

开发者 https://www.devze.com 2022-12-12 11:51 出处:网络
I want to implement htaccess rewriting for the following criteria Url we are havi开发者_开发问答ng example.com/param1

I want to implement htaccess rewriting for the following criteria

  1. Url we are havi开发者_开发问答ng example.com/param1
  2. Url we are having example.com/param1/param2

For url 1 I need to redirect to example.com/param1.php

For url 2 I need to redirect to example.com/param1/param2.php

How to write the htaccess code for this condition??


RewriteRule ^(param1(/param2)?)$ /$1.php [R=301]
0

精彩评论

暂无评论...
验证码 换一张
取 消