Connor Spangler
Connor Spangler

Reputation: 825

Redirecting index.html to [SITE PATH]/phpmyadmin/

I'm trying to redirect users from the index.html page to a phpmyadmin login at https://www.mysite.load.balancer.com

However because I have a production and testing server, with different paths but which I want to behave the same, I'd like the "root" server path to be used and appended with /phpmyadmin/ during the redirect. How can I do this? Currently my code looks like this, in the head section of my index.html page:

<meta http-equiv="refresh" content="3; URL='https://mysite.load.balancer.com/phpmyadmin/'" />

So I would want something like:

<meta http-equiv="refresh" content="3; URL='$SITE_DOM/phpmyadmin/'" />

Thank you!

Upvotes: 0

Views: 765

Answers (1)

Marin N.
Marin N.

Reputation: 366

Method #1

You could use superglobal variables like $_SERVER['SERVER_NAME']; to get your domain. Than you can redirect with

<?php header('Location: $_SEVER['SERVER_NAME']/phpmyadmin/'); ?>

Method #2

Use the same superglobal variable in your meta tag:

<meta http-equiv="refresh" content="3; URL='<?php echo $_SEVER['SERVER_NAME']; ?>/phpmyadmin/'" />

Upvotes: 0

Related Questions