morleo
By:
morleo

Connecting via ip X.XXX.XXX.XXX/. Is asking login and password is OK?

August 16, 2014 3.4k views

Connecting via ip X.XXX.XXX.XXX/

Is asking login and password is OK? (hostname will be later, It's updating It's nameservers)

It looks like .htaccess file in folder doing It.
But in the main folder .htaccess look like

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thank you!

UPDATE:
But site loads in the background and If I press Cancel everything works properly. But It hasn't ask for login and password. (.htaccess login/password window)

1 Answer

To ask for a username and password, you need to add something like this to your .htaccess file:

AuthUserFile /etc/apache2/.htpasswd
AuthGroupFile /dev/null
AuthName "Please Enter Password"
AuthType Basic
Require valid-user

Then to set the password, run:

htpasswd -c /etc/apache2/.htpasswd username

For all the details, check out: How To Use the .htaccess File

by Etel Sverdlov
This tutorial covers five common uses for the .htaccess file. These include: Mod_Rewrite, Authentication, Custom Error Pages, Mime Types, and Server Side Includes.
Have another answer? Share your knowledge.