wordpress - how to make the .htaccess rule work for specified domain ,subdomain or addons -


this cpanel directory structure:

public_html     |--->wordpress installed   sudomain-directory     |--->wordpress installed addon-domain     |--->wordpress installed 

what have done: based on user choice passwd , .htaccess file created respective domains inside wp-admin directory

.htaccess file

authname "member only" authtype basic authuserfile /home/taragurung/public_html/wp-admin/.passfile require valid-user 

now when user try access www.somedomain.com/wp-admin authentication pop , works expected.

problem: problem works wp-admin not www.somedomain.com/wp-login

to make work added <filesmatch "wp-login.php"> rule , created .htaccess in root directory

but doing make rule apply domains , subdomains

why didn't put in root directory: don't want rules implemented on subdomains , addon domains. want implemented on domains or sub-domain user choose to.

i hope i've understood question correctly - want authentication work if user directs specific domain.

to can use if directive.

so, if user x comes domain somedomain.com/wp-login show authentication, if not, not show it.

<if "%{http_host} == 'somedomain.com/wp-login'">     authname "member only"     authtype basic     authuserfile /home/taragurung/public_html/wp-admin/.passfile     require valid-user </if> 

i hope helps , always, clear cache before testing this.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -