title: How to redirect the user to a mobile app or a website on click of a hyperlink sent in an email? Should it need to be handled on server-side using PHP?
body: <p>I've a website which is already developed using <strong>PHPFox</strong> and it's working fine. Now, iOS development team has created a mobile app in iOS for the same functionality as of the website. User can do all the operations using this app which he/she can do on a website. In other words we can say this app is a replica of the existing website. The only restriction in development of app is that the flow and functionality should be same as of the website. There should not be any functionality discrepancy between the app and the existing running website. </p>
  
  <p>For this app, they are using the same functions present into the website's PHPFox code base. I'm making the iOS team these functions available by means of REST APIs developed using Slim framework. In these APIs I'm accepting the request in JSON format from the app, decode it, call the required function from PHPFox code base by passing the required request parameters, get the response from the function, convert it into JSON format and send it back to the mobile app.</p>
  
  <p>Now, let's focus on the issue I'm facing.</p>
  
  <p>In both the scenarios(website and app) for some functionalities like new user account activation link, resend account activation link, reset existing user's password if he/she forgets password, etc. an email is sent to the concerned user. This email contains the relevant hyperlink. When user clicks on this hyperlink sent into the email, it always redirects to the respective web page on website.</p>
  
  <p>When that specific user clicks on the hyperlink present into the received mail it gets redirected to the <strong>website only</strong>. It doesn't redirect to the app.</p>
  
  <p>My requirement is if user has opened the mail on to the device which also has installed/runs the mobile app and clicks on a hyperlink in a mail he/she should redirect to the specific page of mobile app not the website.</p>
  
  <p>And suppose if user has opened a mail on a computer, laptop or a device where the app is not installed he/she should redirect to the website. </p>
  
  <p>How should I achieve this? </p>
  
  <p>One more thing to be noted here is the redirection path(value of the <strong>href</strong> attribute) of the link to be send into the mail is generated into the website's PHPFox code only. So, if I need to make change into the logic to achieve this new functionality how should I do without changing the system flow on app and website? Or should I write a new function for it in order to not change the existing code of PHPFox?</p>
  
  <p>I researched about the solution to this issue. I came to know about <a href="https://bitly.com/" rel="noreferrer">Bitly</a> that could do this job but couldn't understand how.</p>
  
  <p>This requirement is raised by iOS team to me (PHP team) on the basis of <a href="http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html" rel="noreferrer">this hyperlink article</a> they have found on the internet. Please refer this also. </p>
  
  <p>So, my straight-forward question is since this article is about iOS coding and it nothing has to do with server-side coding (i.e. PHP) should I have to do anything on server-side using PHP to achieve this functionality?</p>