use .htaccess redirection to connect to vpn

牧云@^-^@ 提交于 2020-01-07 06:58:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!