Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:47:42+00:00 2026-06-03T04:47:42+00:00

I am trying to create a ‘simple’ redirect for clients who use either WordPress

  • 0

I am trying to create a ‘simple’ redirect for clients who use either WordPress or Indexhibit to manage there sites.

I have set it up to allow them to input their domain and have it redirect to the respective Admin areas (I am amazed at how many people forget but hey ho this is my solution)

I got it working fine for a single redirect but off the back of a previous SO submission tried to integrate both using if / elseif and it fails to Parse.

Any ideas what I have done wrong / help much appreciated!

<?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; ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:47:43+00:00Added an answer on June 3, 2026 at 4:47 am

    you are mixing up ternary and non ternary operators:

    just use normal if/else syntax:

    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/');
        }
    }
    

    and keep in mind that working with PHP_SELF like this it makes your code vulnerable to xss injections

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
I'm trying create a simple bookmarklet to capture the title and url of a
I am trying create a 'live' view where our clients can edit the colors
Trying to create a simple document that gets the parentNode then applies a background
Trying to create a simple plugin that simply connects to an ftp site, looks
I am trying create a layout. There are several inner layouts that should like
I am trying create a simple WQL query where I only return mounted drives
I'm trying create a simple audio stream server like a concept proof, but I'm
I'm trying create a composite component to use across my projects, so, I've created
I'm trying create simple application in C++. This application has to read from file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.