{"id":2889,"date":"2013-09-08T14:04:46","date_gmt":"2013-09-08T14:04:46","guid":{"rendered":"http:\/\/www.webputzer.com\/?p=2889"},"modified":"2018-09-05T17:11:55","modified_gmt":"2018-09-05T17:11:55","slug":"htaccess-some-useful-tips","status":"publish","type":"post","link":"http:\/\/www.webputzer.com\/?p=2889","title":{"rendered":"Htaccess &#8211; password generators, common usage"},"content":{"rendered":"<h2>Password Generator(s)<\/h2>\n<p><a href=\"http:\/\/www.webputzer.com\/htpasswd\/\" target=\"_blank\">Password Generator #1<\/a><br \/>\n<a href=\"http:\/\/www.webputzer.com\/htpasswd\/passwd2.php\" target=\"_blank\">Password Generator #2<\/a><\/p>\n<h2>Password Protect a Directory<\/h2>\n<pre>\r\nAuthUserFile \/usr\/local\/apache2\/somesite\/somefolder\/.htpasswd\r\nAuthGroupFile \/dev\/null\r\nAuthName \"Enter User and Pass\"\r\nAuthType Basic\r\n\r\n&lt;Limit GET POST&gt;\r\nrequire valid-user\r\n&lt;\/Limit&gt;\r\n<\/pre>\n<h2>Redirect all requests to a specific page<\/h2>\n<pre>\r\nOptions +FollowSymlinks\r\nRewriteEngine on\r\nRewriteCond %{REQUEST_URI} !\/maintenance.html$ \r\nRewriteRule $ \/maintenance.html [R=302,L]<\/pre>\n<h2>Allow access to lower-level directory<\/h2>\n<pre>\r\nAllow from all\r\nSatisfy Any<\/pre>\n<p><strong>NOTE: The following directive, inserted into the Apache vhost-conf file, accomplishes the same as the above:<\/strong><\/p>\n<pre>\r\n&lt;Directory \"\/usr\/local\/apache2\/netkwik\/htdocs\/phpmyadmin\">\r\n     Satisfy Any\r\n<&lt;Directory><\/pre>\n<h2>Prevent download of specific file types<\/h2>\n<pre>RewriteCond %{HTTP_REFERER}    !www.formula4data.com\/ufo \r\nRewriteRule \\.(jpg|gif|png|mp4)$   -                 [F,L]<\/pre>\n<h2>Example Worpdress Htaccess<\/h2>\n<pre># DENY all requests from following IP addresses:\r\n\r\nOrder Deny,Allow\r\nDeny from 104.202.61.228\r\nDeny from 5.\r\n \r\n\r\n&lt;Files xmlrpc.php>\r\nOrder allow,deny\r\nDeny from all\r\n&lt;\/Files>\r\n\r\nRewriteEngine on\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?srv03.aloewebs.com.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?mail.votreebook.com.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?amazonaws.com.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?dynamic.ziggo.nl.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?odin.domene.no.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?server.2share.tv.*$ [NC]\r\nRewriteCond %{HTTP_REFERER} ^http(s)?:\/\/(www\\.)?lvv.broadband.kyivstar.net.*$ [NC]\r\nRewriteRule .* - [F,L]\r\n\r\n\r\n# BEGIN WordPress\r\n&lt;IfModule mod_rewrite.c>\r\n   RewriteEngine On\r\n   RewriteBase \/\r\n   RewriteCond %{REQUEST_FILENAME} !-f\r\n   RewriteCond %{REQUEST_FILENAME} !-d\r\n   RewriteRule ^(.+)$ \/index.php\/$1 [L,QSA]\r\n&lt;\/IfModule>\r\n# END WordPress\r\n\r\n# compress text, HTML, JavaScript, CSS, and XML\r\nAddOutputFilterByType DEFLATE text\/plain\r\nAddOutputFilterByType DEFLATE text\/html\r\nAddOutputFilterByType DEFLATE text\/xml\r\nAddOutputFilterByType DEFLATE text\/css\r\nAddOutputFilterByType DEFLATE application\/xml\r\nAddOutputFilterByType DEFLATE application\/xhtml+xml\r\nAddOutputFilterByType DEFLATE application\/rss+xml\r\nAddOutputFilterByType DEFLATE application\/javascript\r\nAddOutputFilterByType DEFLATE application\/x-javascript\r\n\r\n# remove browser bugs\r\nBrowserMatch ^Mozilla\/4 gzip-only-text\/html\r\nBrowserMatch ^Mozilla\/4\\.0[678] no-gzip\r\nBrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html\r\nHeader append Vary User-Agent\r\n\r\n&lt;ifModule mod_gzip.c>\r\nmod_gzip_on Yes\r\nmod_gzip_dechunk Yes\r\nmod_gzip_item_include file .(html?|txt|css|js|php|pl|woff|woff2)$\r\nmod_gzip_item_include handler ^cgi-script$\r\nmod_gzip_item_include mime ^text\/.*\r\nmod_gzip_item_include mime ^application\/x-javascript.*\r\nmod_gzip_item_exclude mime ^image\/.*\r\nmod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*\r\n&lt;\/ifModule>\r\n\r\n## EXPIRES CACHING ##\r\n&lt;IfModule mod_expires.c>\r\nExpiresActive On\r\nExpiresByType image\/jpg \"access 1 year\"\r\nExpiresByType image\/jpeg \"access 1 year\"\r\nExpiresByType image\/gif \"access 1 year\"\r\nExpiresByType image\/png \"access 1 year\"\r\nExpiresByType text\/css \"access 1 month\"\r\nExpiresByType text\/html \"access 1 month\"\r\nExpiresByType application\/pdf \"access 1 month\"\r\nExpiresByType text\/x-javascript \"access 1 month\"\r\nExpiresByType application\/x-shockwave-flash \"access 1 month\"\r\nExpiresByType image\/x-icon \"access 1 year\"\r\nExpiresDefault \"access 1 month\"\r\n&lt;\/IfModule>\r\n## EXPIRES CACHING ## <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Password Generator(s) Password Generator #1 Password Generator #2 Password Protect a Directory AuthUserFile \/usr\/local\/apache2\/somesite\/somefolder\/.htpasswd AuthGroupFile \/dev\/null AuthName &#8220;Enter User and Pass&#8221; AuthType Basic &lt;Limit GET POST&gt; require valid-user &lt;\/Limit&gt; Redirect all requests to a specific page Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !\/maintenance.html$ RewriteRule $ \/maintenance.html [R=302,L] Allow access to lower-level directory Allow from all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4881,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"h5ap_radio_sources":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2889","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/2889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2889"}],"version-history":[{"count":0,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/2889\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/media\/4881"}],"wp:attachment":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2889"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}