Despite a good deal of searching here I haven't been able to find the solution to this problem.
I have an .htaccess file that is protecting a Wordpress site that I am developing. I would like to protect the entire site except for the directory /images/, but I can't work out how to do this. At the moment my .htaccess file, in the root of the site, looks like this:
# 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
# basic password protection
<IfModule mod_authn_file.c>
AuthUserFile /home/*****/.htpasswd
AuthName "Username and password required"
AuthType Basic
<Limit GET POST>
Require valid-user
</Limit>
</IfModule>
Could someone help me to amend this to allow open access to the /images/ directory?
Thanks,
Nick
You can create a new .htaccess-file in the /images/-directory:
Order Deny,Allow
Allow from all
Satisfy any
This should remove the password protection for this folder.
Related
I have no experience whatsoever with .htaccess and I've been reading for awhile now but to no success. My site is using wordpress and I need to edit the .htaccess file to insert a string inside my url just like this.
mysite.com/?a=c&b=2 to this mysite.com/mobile?a=c&b=2
So if I enter the first URL it'll proceed to the next one. Also, since my site is using wordpress, I have no idea where to insert the codes.
# 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
<FilesMatch "wp-login.php">
AuthName "WordPress Admin"
AuthType Basic
AuthUserFile /usr/www/users/ineedjkfup/./wp-admin/.htpasswd
require valid-user
</FilesMatch>
help me Gurus. Please. :D :D
I'm trying to setup HTTP authentication to protect my site. The site is hosted with Azure.
AuthType Basic
AuthName "Protected Area"
AuthUserFile D:\\home\\site\\wwwroot/.htpasswd
Require valid-user
# 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
This is being completely ignored. To test further I deleted my .htaccess altogether and my site still works fine. It is being completely ignored.
Please see the following link: Mod_rewrite in Azure
.htaccess is not read by Azure websites. You must create your rules in your web.config file
If you want to use an .htaccess file you would need to stand up a Linux VM with apache and go that route.
Hope this helps!
I have a directory memories and there is a subdirectory in it /memories/application/controllers/admin.
I want to protect admin directory using .htaccess and .htpasswd.
This is my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
AuthUserFile /var/www/memories/application/controllers/admin/.htpasswd
AuthType Basic
AuthName "memories with mom"
Require admin
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
# Various security things
ServerSignature off
php_value expose_php Off
php_value session.cookie_httponly On
Options -Indexes
ErrorDocument 403 /404.php
But it is protecting the whole parent directory, whereas I only want the subdirectory admin to be protected. My .htpasswd is also in admin folder.
If you only want the subdirectory admin protected by the .htpasswd file then only put the auth specific htaccess code in that subdirectory and not the .htaccess for the whole site.
/var/www/memories/application/controllers/admin/.htaccess should only be
AuthUserFile /var/www/memories/application/controllers/admin/.htpasswd
AuthType Basic
AuthName "memories with mom"
Require admin
and remove the above code from your main .htaccess
Hello i tried too much and i coudln't find a solution so i decided to ask here currently iam using wordpress website and my pages and posts link will be www.mydomain.com/postname and i want to make members user profile link like www.mydomain.com/user/profilename must redirect to profile.php?user=Username
Currently iam having this code in .htaccess:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName sampcnc.com
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
So please help how to do this , Thanks in advance
i want to make members user profile link like www.mydomain.com/user/profilename must redirect to profile.php?user=Username
Before your wordpress rules # BEGIN WordPress, add these:
RewriteEngine On
RewriteRule ^/?user/(.*)$ /profile.php?user=$1 [L,QSA]
So when someone entes www.mydomain.com/user/profilename in their browser's URL address bar, they get served the content at /profile.php?user=profilename. You'll just have to make sure any links you generate look like the /user/profilename version.
I have an htaccess file as follows:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule . - [L]
RewriteRule ^$ app/ [L]
RewriteRule (.+) app/$1 [L]
</IfModule>
Now, this is located in my web root, and I wanted to also password protect this and all sub-directories, so I added the following lines:
AuthName "phpMyAdmin Restricted Area."
AuthType Basic
AuthUserFile /usr/local/apache/.htpasswd
Require valid-user
This promted me and I was able to 'log in'. However, now my server is 500'ing on me, and I am not sure why. I can remove the auth lines, and this fixes the problem. Why is this happening, and what can I do?
conflictions with another .htaccess file in the root dir.