URL rewrite in Apache for POST/DELETE/PUT
I have my url like this http://10.243.123.1/v1/data/register I want to redirect/rewrite this url to 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. What rule should in need to add in httpd.conf file..?? Whether rule goes to httpd.conf or .htacccess file? Please share your thoughts Put this code in your 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