我的网址是这样的
http://10.243.123.1/v1/data/register
我想重定向/重写这个网址到
https://10.243.123.1/data/register (This is HTTP POST/PUT/DELETE url)
i.e
1.should remove v1 and make https
2.If url does not contains v1 then just make https alone.
需要在 httpd.conf 文件中添加什么规则..?
规则是否转到 httpd.conf 还是 .htaccess 文件?
请分享您的想法
将此代码放入您的DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+v1/(\S+) [NC]
RewriteRule ^ https://%{HTTP_HOST}/%1? [R=302,L,NE]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,NE]
RewriteRule !^v1/ /v1%{REQUEST_URI} [NC,L]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)