I have a little issue here I have been looking all over and haven't found a solution.
I want to redirect my page once my users have logged in, but I will log them into a secure server. I'm using virtual host on apache so one is the http page and the othe one is the https server for secure encrypted connection.
on my login.php I have this
if( $usr->userLogin() ) {
echo "Welcome, now you can continue to our secure webpage. You will be automatically redirected in 5 seconds.....";
echo "<meta http-equiv=Refresh content=5;url=index.php>";
} else {
echo "Incorrect Username/Password, please try again.....";
echo "You will be automatically redirected in 5 seconds.....";
echo "<meta http-equiv=Refresh content=5;url=login.php?id=1>";
}}
but actually what I want is that instead of making the redirection to the index.php file on /var/www/http, I want to make the redirection to index.php on the directory /var/www/https/
That is my problem I have tried a lot of stuff but nothing that line will be like
echo "<meta http-equiv=Refresh content=5;url=index.php>";
There is one more problem I'm using a VPN to connect to the server, so I cannot connect like echo "<meta http-equiv=Refresh content=5;url=https://www.url.com>";
I cannot go to the DNS and resolve the name and then get the IP, and like it is a VPN the address is internal I cannot put any external address because the problem will persist, that is my real problem is there any way to do it internally?
Use PHP header:
header("location: <url>");
like so:
header("location: https://<etc>"); // redirect to different page but only if no other output has been generated
exit; // prevents further execution of code
Be aware that you cannot redirect to a filepath, but only to an url. So if you want to serve the HTTPS page your webserver must serve it via a domain/url. So you would need to use a SSL certificate and configure your webserver to serve the https (port 443) request from within your https directory.
I hope this make sense ;)
If you want to continue using the html redirect (perhaps if you are using the redirect in your html or if you can't use the php redirect):
echo "<meta http-equiv=Refresh content=5;url=https://<domain>/login.php?id=1>";
Seeing your comment on the other answer concerning your VPS. You still need to configure your server to handle the request to the 443 (ssl) port. Even if your server has a dynamic IP or you're connecting through VPN, you can always edit your vhosts file to point a certain (non-existing) domain to an IP, even if it is a local, network or VPN tunneled IP. Your main focus at this time would be to configure your server correctly.