Failurl not redirecting properly

Nirvash

Registered
Dec 28, 2012
3
0
1
cPanel Access Level
Root Administrator
I have been working on a custom webmail login page for my site, but one thing keeps being an issue.
I can't get the failurl parameter to work properly. No matter what instead of redirecting back to the page (/https://domain/login/example/index.php) , it will default to the cPanel webmail page (/https://domain:2096/login/).

Based off of cPanel documentation I have been using this code for the login form. And it does work to log in.
Code:
<div id="main">

	<h1 class="cec"></h1>
	<fieldset class="cec">

		<font size="+1" color="#0000a0">Webmail Login</font> 
		
		<?php 
		print "<form class=\"cec\" action=\"https://" . $_SERVER['HTTP_HOST'] . ":2096/login/\" method=\"post\">";
		?> 

		<div class="cec">
			<label class="cec">User:</label>
			<input type="text" name="user" class="short" id="user">
		</div>
		<div class="cec">
			<label class="cec">Password:</label>
			<input type="password" name="pass" class="short" id="pass">
		</div>
		
		<?php 
		print "<input type=\"hidden\" name=\"failurl\" value=\"http://" .  $_SERVER['HTTP_HOST'] . 
		$_SERVER['PHP_SELF'] . "?failed=1\">"; 
		echo "failurl is:  http://" .  $_SERVER['HTTP_HOST'] . 
		$_SERVER['PHP_SELF'] . "?failed=1\""; //User readable, to verify url
		?>
		
		<div class="cec2">
			<label class="cec">&nbsp;</label>
			<div class="right-div">	
				<input type="submit" src="press this"/>
			</div>
		</div>

	</fieldset>
	</form>	
</div>

And I have added these two lines to the "/usr/local/cpanel/failurls" file, I wasn't sure which was was proper as the documentation on failurls is a bit iffy. After adding them I ran the command "/usr/local/cpanel/startup"
Code:
https://domain/login/example/index.php
https://domain/login/example/
I am stumped and any help on this would be very appreciated.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
The file is not /usr/local/cpanel/failurls but /var/cpanel/failurls (see The failurls File).

The format is:

1. One URL per line
2. Each line is new line separated.

The other requirements are spelled out in the document I linked.