Is it possible to limit access to the Control Panel to a specific HTTP port, which is shielded from public access? We want external visitors to only be able to access the front end site.

1 Answer 1


First set your web server up so the full website gets loaded from both the external ports (e.g. 80 and 443) as well as your internal port (let's say 9001).

Then open your index.php file, and add this to the top of it:

// Restrict CP access to port 9001
if (
    $_SERVER['SERVER_PORT'] != 9001 && 
    isset($_GET['p']) &&
    preg_match('^\/*admin(\/.*)?$/', $_GET['p'])
) {
    echo 'You are not authorized to access this area.';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.