我正在尝试为使用 Wordpress 或 Indexhibit 管理网站的客户创建一个“简单”重定向。
我已将其设置为允许他们输入他们的域并将其重定向到相应的管理区域(我很惊讶有多少人忘记了,但是嘿,这是我的解决方案)
我让它对于单个重定向工作正常,但是在之前的 SO 提交的后面尝试使用 if / elseif 集成两者并且它无法解析。
任何想法我做错了什么/帮助非常感谢!
<?php
if ($_POST['indexhibit_url']) {
if($_SERVER['REQUEST_METHOD'] == 'POST') : $indexhibit_url = $_POST['indexhibit_url']; header('Location: http://' . $indexhibit_url . '/ndxz-studio/');
}
elseif ($_POST['wordpress_url']) {
if($_SERVER['REQUEST_METHOD'] == 'POST') : $wordpress_url = $_POST['wordpress_url']; header('Location: http://' . $wordpress_url . '/wp-admin/');
}
?>
<form action="<?php echo $_SERVER['../PHP_SELF']; ?>" method="post" name="indexhibit_url">
<h3>Indexhibit</h3>
<p class='formp'>If your website is powered by <em>Indexhibit</em> submit your URL to be forwarded to your admin area</p>
<input class='loginforms' type="text" value='i.e. your-domain-name.com' onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'i.e. your-domain-name.com':this.value;" name="indexhibit_url" />
<input class="btn btn-info loginbuttons" name="index_submit" type="submit" value="Go" />
</form>
<form action="<?php echo $_SERVER['../PHP_SELF']; ?>" method="post" name="wordpress_url">
<h3 style='margin-top:2em;'>Wordpress</h3>
<p class='formp'>If your website is powered by <em>Wordpress</em> submit your URL to be forwarded to your admin area</p>
<input class='loginforms' type="text" value='i.e. your-domain-name.com' onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'i.e. your-domain-name.com':this.value;" name="wordpress_url" />
<input class="btn btn-info loginbuttons" name="wp_submit" type="submit" value="Go" />
</form>
<?php endif; ?>