Home Particular URL redirect to http if request come from particular host
Reply: 0

Particular URL redirect to http if request come from particular host

user1148
1#
user1148 Published in June 20, 2018, 7:42 am

Web server is apache, ssl configured, listening on 443, All http requests will be redirected to https using rewrite rule

Issues is all url's are serving through https, but we want to connect to the web server through http if the request is coming for particular url from particular host, rest all should be served through ssl

Example:

When we access the url /test/devices, normally it will server through ssl like https://example.com/test/devices

But when we access the url /test/devices from host 10.1.2.3 the request should server through http protocol instead of https

This should happen only from this host, if any other hosts access this url they should be served through ssl

The current rewrite url we are using

RewriteEngine on
RewriteRule ^/$ /test/ [R=301,L]

RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

The first rule will redirect all requests to test folder

The second rule will redirect requests to https

Appreciate your responses!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312811 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO