WordPress App how to restrict access to specific pages on the site

Sergei Drew 40 Reputation points
2023-11-23T08:49:22.3166667+00:00

Hello all,

 

I have a WordPress App hosted on Azure and I am struggling with how I can secure specific pages from public access. 

 

For example:

 

[www.mysite.com/wp-admin]

[www.mysite.com/info.php]

 

I'd like it so that only specific IP addresses or Microsoft user accounts can access some, such as admin pages and for some pages I'd like no access at all, to where it just blocks any sort of visit. 

 

I've viewed the documentation for Front Door and some networking restrictions but that seems to be just IP addresses and I'm confused about how I can set those rule for specific pages within the App/Site. 

 

I know WordPress offer plugins which have this sort of functionality but I'd like to take advantage of Azure's security features rather than plugins from WordPress. 

 

Any help is very appreciated. Thank you

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,463 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,116 Reputation points Microsoft Employee
    2023-11-30T09:31:49.1233333+00:00

    Adding more:

    You may follow the suggestions outlined (step-step) in the below guide walks through configuring IP access restrictions on wp-admin for the WordPress on App Service offering.

    How to enable IP access restrictions on wp-admin for the WordPress on App Service offering

    The article outlines the following high-level steps:

    1. Using the SSH console, copy /etc/nginx/conf.d/default.conf to /home/dev/default.conf
    2. Edit /home/dev/default.conf to use the X-Forwarder-For header and add a location block for wp-login.php
    3. Update /home/dev/startup.sh with the below snippet
    4. Point to /home/dev/startup.sh in the App Service portal under configuration –> general settings. Saving the changes will restart the App Service.
    5. Test the access using different devices to ensure the IP access restrictions are applied.

    (converting to answer from comment) + adding summary


    If the answer helped (pointed, you in the right direction) > please click Accept Answer Or please share the requested/more info to help you better.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.