问题
I am trying to connect to a VPN connection using an automatic redirection via a .htaccess
redirection, so the vpn setup is a bit more user-friendly using an url instead of an ip address.
The thing is that, when using the ip directly, all works smoothly. However, using .htaccess
which redirects to my public IP address throws an Error 868
.
My .htaccess
is very basic - all I do is forward the input to the public IP without any filter:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ my.public.ip.address$1
The reason I am trying this is that I have successfully setup VPN via sub-domain redirecting to the public IP, so I'm wondering why the .htaccess
redirection wouldn't work...
回答1:
Your my.public.ip.address is not prefixed with either http:// or https:// also you could do with a few flags: [R,L] where: R = redirect (browser rather than an invisible server side internal job) and L = last flag to trigger immediate execution, also you don't need your regular expression, anyway try:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule .* https://11.22.33.44%{REQUEST_URI} [R,L]
来源:https://stackoverflow.com/questions/32074593/use-htaccess-redirection-to-connect-to-vpn