用正则表达式重写规则以添加正斜杠
rewrite rule with regex to add forward slash
我想知道我怎样才能把这个 url :
https://www.mywebsite.com/online/param1/param2
进入
https://www.mywebsite.com//online/param1/param2
或进入
https://www.mywebsite.com/en/online/param1/param2
谢谢大家!
您可以在 root .htaccess 中使用此规则:
RewriteEngine On
# case 1
RewriteCond %{THE_REQUEST} !\s//
RewriteRule ^(online/.*)$ // [R=302,NC,L,NE]
# case 2
RewriteRule ^(online/.*)$ /en/ [R=302,NC,L,NE]
我想知道我怎样才能把这个 url :
https://www.mywebsite.com/online/param1/param2
进入
https://www.mywebsite.com//online/param1/param2
或进入
https://www.mywebsite.com/en/online/param1/param2
谢谢大家!
您可以在 root .htaccess 中使用此规则:
RewriteEngine On
# case 1
RewriteCond %{THE_REQUEST} !\s//
RewriteRule ^(online/.*)$ // [R=302,NC,L,NE]
# case 2
RewriteRule ^(online/.*)$ /en/ [R=302,NC,L,NE]