问题
This is my .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^([^\.]+)$ $1.php/$1 [L]
</IfModule>
AuthType Basic
AuthName "Restricted Content"
AuthUserFile .htpasswd
Require valid-user
I have Add htaccess authentication only for this URL "welcome/list" no another all pages/URLs
回答1:
#Set an environment variable for the URI you want to handle
SetEnvIf Request_URI "/welcome/list" welcome_list
AuthName "Restricted Content"
AuthType Basic
AuthUserFile .htpasswd
Order Allow, Deny
Satisfy any
Allow all
Require valid-user
#Handle case
Deny from env=welcome_list
来源:https://stackoverflow.com/questions/61931993/how-to-authenticate-specific-single-page-url-in-htaccess-and-codeigniter