linuxfront-v2-logistics/app-admin/index.php
Overview
This file serves as the entry point for the logistics application’s admin interface. Upon access, it immediately redirects users to the external admin portal at app-admin.freightanywhere.com.
Purpose
- Ensure that any attempt to reach the local
app-adminfolder lands on the centralized admin application. - Provide both client-side and server-side redirection to maximize compatibility.
- Prevent direct interaction with backend files in this directory.
Redirect Logic 🚀
Below is the complete content of index.php. It implements a two-fold redirection strategy:
<script type="text/javascript">
// Client-side redirect for modern browsers
window.location = "http://app-admin.freightanywhere.com/";
</script>
<?php
// Server-side fallback redirect
header("http://app-admin.freightanywhere.com/");
exit();
?>
(excerpted from the source file )
Code Breakdown
| Step | Layer | Statement | Purpose |
|---|---|---|---|
| 1 | JavaScript (HTML) | <script> window.location = "http://app-admin.freightanywhere.com/"; </script> |
Triggers immediate redirect in the browser |
| 2 | PHP | header("http://app-admin.freightanywhere.com/"); exit(); |
Ensures redirect when JS is disabled or blocked |
Usage Flow
- Browser loads this minimal PHP file.
- JavaScript executes and navigates the user to the admin domain.
- If JS is turned off, PHP’s
header()call triggers an HTTP redirect. exit()halts further processing.
Related Components 🔗
- Configuration: In
inc/config.php, constants likeAPP_ADMIN_URLandAPP_ADMIN_DIRdefine trusted admin endpoints and directories . - Companion Directory: A similar redirect exists in
linuxfront-v2/app-admin/index.php(points to a beta URL) . - Security Guards: Other parts of the app use session checks (e.g.,
user_secure.inc.php) to control access before forwarding to this script.
Security Considerations ⚠️
- The hard-coded URL prevents open-redirect exploits.
- No additional output avoids header errors.
- Ensure this file cannot be overwritten or modified by unauthorized users.
Conclusion
This lightweight redirect script streamlines access to the centralized admin portal, combining both client-side and server-side techniques to ensure all users are properly forwarded.