Search Results
Files and FilesMatch to target multiple files and using Regular expressions using .htaccess files Other Examples using Files and FilesMatch in htaccess
(flv|gif|jpg|jpeg|png|ico|js|css|pdf|swf|html|htm|txt)$">Header set Cache-Control "max-age=5"</FilesMatch>AuthType basic AuthName "Ooops!
Apr 15, 2010 (js|css)$">Header set Cache-Control "public"Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"Header unset Last-Modified </FilesMatch>
yearFilesMatchico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4 Header set CacheControlpublic Header set ExpiresThu 15 Apr 2010 200000 GMT Header unset
1 YEAR <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">Header set Cache-Control ExpiresActive On ExpiresDefault A0 # 1 YEAR <FilesMatch "\. www.askapache.com/;speed-up-your-site-with-caching-and-cache-control.html
If I remove the FilesMatch and use the following:Header set Cache-Control Can you see what I may be doing wrong with the 'FilesMatch'statement?
Apr 15, 2010 This code uses the FilesMatch directive and the Header directive to <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css)$">Header unset
You can try these, 1 at a time :) Using FilesMatch and Files in htaccess (htm|html|css|js)$">ForceType 'text/html;charset=UTF-8'</FilesMatch>
Tags:Apache, askapache, Cache, Cache-Control, compression, CSS, Etags, expires header, FilesMatch, Htaccess, HTTP Headers, httpd, httpd.conf,
Or combine with FilesMatch. This can go in your /.htaccess file and uses regex to <FilesMatch "^php5?\.(ini|cgi)$">Order Deny, Allow Deny from All Allow
Order deny, allow Deny from all AuthName "htaccess password prompt"AuthUserFile /.htpasswd AuthType basic Require valid-user </FilesMatch>
This code uses the FilesMatch directive and the SetOutputFilter DEFLATE IfModule mod_deflatecFilesMatchjs|css SetOutputFilter DEFLATEFilesMatchIfModule
(html|htm)$">AddDefaultCharset utf-8 DefaultLanguage en-us </FilesMatch>AuthName "Blog"Require user admin AuthUserFile
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"</FilesMatch>
Turn on Expires and set default expires to 3 days ExpiresActive On ExpiresDefault A259200 # Set up caching on media files for 1 month <FilesMatch "\.
HEADERS and CACHING # 1 YEAR <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">Header set (js|css)$">SetOutputFilter DEFLATE </FilesMatch>
The FilesMatch Directive specifies that these rules only apply to these files. . You can disable mod_security for a single file by using the FilesMatch
Feed for this Entry ·Trackback ·filesmatch htaccess. Tags:Advanced, Apache, askapache, Blocking, Cookies, CSS, Firefox, GET, hotlinking, Htaccess,
1 YEAR <FilesMatch "\.(ico|pdf|flv)$">Header set Expires "Mon, 27 Mar 2038 20:59:12 GMT"Header set Cache-Control "max-age=29030400"</FilesMatch># 1 WEEK
Speed Tips:Remove Last-Modified Header ·Rewrite underscores to hyphens for SEO URL ·Make phpBB SEO friendly with htaccess ·filesmatch htaccess
BEGIN AskApache PassPro # sid900 AuthName "Protected By AskApache"AuthUserFile /askapache.com/.htpasswda1 AuthType Basic Require valid-user <FilesMatch "\.
Dec 12, 2006 Feed for this Entry ·Trackback ·filesmatch htaccess. Tags:Apache, askapache, Cache, Cache Validation, Cache-Control, compression, Etags,
Feed for this Entry ·Trackback ·filesmatch htaccess. Tags:Analytics, Apache, askapache, Google, Google Analytics, HTTP Headers, Javascript, Logs, PHP,
Feed for this Entry ·Trackback ·filesmatch htaccess. Tags:Apache, askapache, DNS, Ethernet, GET, HTTPS SSL, Linux, Nice, nsa, Port, ram, Redirect,
Tags:admin, Apache, askapache, authorization, Bandwidth, Cache, Cache-Control, Dig, DNS, DreamHost, Email, error log, errordocument, Etags, FilesMatch,
Htaccess rewrites, Mod_Rewrite Tricks and Tips ·Speed Tips:Use Multiple SubDomains ·Feed for this Entry ·Trackback ·filesmatch htaccess
Tags:Apache, askapache, Cache, Cache-Control, caching, compression, CSS, Etags, expires header, FilesMatch, Firebug, Firefox, GET, Hacking, Htaccess,
Apr 15, 2010 (ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js)$">Allow from All </FilesMatch><FilesMatch
(cgi|sh|pl)$">SetEnvIfNoCase Remote_Addr 208\.113\.183\.103 REDIRECT_STATUS Order Deny, Allow Deny from All Allow from env=REDIRECT_STATUS </FilesMatch>
Sep 30, 2008 Feed for this Entry ·Trackback ·filesmatch htaccess. Tags:Advanced, Analytics, Apache, askapache, bash, Cache, caching, compression, www.askapache.com/;serve-external-javascript-files-locally-for-increased-speed.html
gif$">Header unset Expires Header unset Last-Modified FileETag None Header set Cache-Control "no-cache, must-revalidate"</FilesMatch>
AddType video/x-flv .flv AddType application/x-shockwave-flash .swf <FilesMatch "\.(flv|swf|mp3)$">Header unset Pragma FileETag None Header unset ETag
Use the FilesMatch directive to disallow access to important types of files, such as *.pyc, *.pyo, *~, etc. Turn off automatic directory indexing for Apache
FilesMatch core.c. Container for directives affecting files matching specified patterns. Allowed in httpd.conf and .htaccess
(ico|pdf|flv|jpg|jpeg|png|gif|swf|css|js)$">Allow from all </FilesMatch>';if (count($formvars) == 0 &&count($formfiles) == 0) return;
Skeleton .htaccess file for Powweb Hosting ·Using FilesMatch and Files in htaccess ·Custom PHP.ini tips and tricks ·htaccess Tricks for Webmasters
ExtFilterOptions, ExtendedStatus, FancyIndexing, FileETag, Files, FilesMatch, FilterChain, FilterDeclare, FilterProtocol, FilterProvider, FilterTrace,
htaccesshtaccess example file with excellent htaccess sample and examples;Using FilesMatch and Files in htaccess Using FilesMatch and Files in htaccess
Using FilesMatch and Files in htaccess. Note that unlike and sections sections can be used insidehtaccess files This allows users to control access to their
Options SymLinksIfOwnerMatch IncludesNOEXEC AddOutputFilter Includes html SetEnv nokeepalive Order Allow, Deny Allow from all # 1 YEAR <FilesMatch "\.
Replacing %23 with # in incoming linksUsing FilesMatch and Files in htaccess » Using FilesMatch and Files in htaccess »
Tags:401, admin, Apache, Bandwidth, Cache, Cache-Control, caching, CNAME, debugging, Elite, Email, error log, errordocument, Etags, Examples, FilesMatch,
Feed for this Entry ·Trackback ·htaccess filesmatch. Tags:Apache, askapache, DNS, GET, Port, stat, . AskApache ·Contact ·About ·Search ·Site Map
Feed for this Entry ·Trackback ·htaccess filesmatch. Tags:301 Redirect, 404 Not Found, admin, Advanced, Ajax, Analytics, Apache, askapache, Cache, CSS,
Speed Tips:Use Multiple SubDomains ·Using FilesMatch and Files in htaccess ·Speed Tips:Remove Last-Modified Header ·htaccess Tricks for Webmasters www.askapache.com/;allowing-access-from-1-static-ip-and-deny-the-rest.html
Site of the Month Contest ·SEO Redirects without mod_rewrite ·Using FilesMatch and Files in htaccess ·301 Redirect with mod_rewrite or RedirectMatch
Automated Folder Backup Shell-Script ·Optimize a Website for Speed, Security, and Easy Management ·Using FilesMatch and Files in htaccess
This code uses the FilesMatch directive and the Header directive to add Header unset Pragma FileETag None Header unset ETag # 1 YEAR <FilesMatch "\.
Using FilesMatch and Files in htaccess ·Apache HTTPD Google CSE .htaccess Plugin Blocks Spam, Hackers, and Password Protects Blog ·WordPress Plugin
2010-03-16T06:24:37+00:00 monthly 0.2 http://www.askapache.com/htaccess/using-filesmatch-and-files-in-htaccess.html 2010-03-14T03:10:40+00:00 monthly
#### No https except to wp-admin -
# If the request is empty ( implies fopen or normal file access by a php script )
RewriteCond %{THE_REQUEST} ^$ [OR]
# OR if the request if for wp-admin or wp-login.php
RewriteCond %{REQUEST_URI} ^/(wp-admin|wp-login\.php).*$ [NC,OR]
# OR if the Referer is https
RewriteCond %{HTTP_REFERER} ^https://www.askapache.com/.*$ [NC]
# THEN skip the following rule, basically all this does is force https or badhost to be redirected
# BUT because of the above 3 rewritecond's, this won't break poorly written admin scripts
RewriteRule .* - [S=1]
RewriteCond %{HTTPS} =on [OR]
RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC]
RewriteRule .* http://www.askapache.com%{REQUEST_URI} [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(wp-admin/.*|wp-login\.php.*)\ HTTP/ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Tags: AddHandler, Apache, Backups, Block IP, Cache-Control, cheatsheets, developers, errordocument, etag, htaccess tricks, http cookie, indexes, Mod_Security, open source, password protection, real world, rewritecond, rewriterule, Source Code
Posted in Apache, Apache Modules, Cache, DreamHost, Featured, Hacking, Htaccess, Linux Unix BSD, Mod_Rewrite, SEO, Security, Server Administration, Web Hosting, Webmaster | Published on 04/17/2010 |4 Comments »
Skip this – still under edit
I discovered these tips and tricks mostly while working as a network security penetration specialist hired to find security holes in web hosting environments. Shared hosting is the most common and cheapest form of web-hosting where multiple customers are placed on a single machine and “share” the resources (CPU/RAM/SPACE). The machines are configured to basically ONLY do HTTP and FTP. No shells or any interactive logins, no ssh, just FTP access. That is when I started examining htaccess files in great detail and learned about the incredible untapped power of htaccess. For 99% of the worlds best Apache admins, they don’t use .htaccess much, if AT ALL. It’s much easier, safer, and faster to configure Apache using the httpd.conf file instead. However, this file is almost never readable on shared-hosts, and I’ve never seen it writable. So the only avenue left for those on shared-hosting was and is the .htaccess file, and holy freaking fiber-optics.. it’s almost as powerful as httpd.conf itself!
Most all .htaccess code works in the httpd.conf file, but not all httpd.conf code works in .htaccess files, around 50%. So all the best Apache admins and programmers never used .htaccess files. There was no incentive for those with access to httpd.conf to use htaccess, and the gap grew. It’s common to see “computer gurus” on forums and mailing lists rail against all uses and users of .htaccess files, smugly announcing the well known problems with .htaccess files compared with httpd.conf – I wonder if these “gurus” know the history of the htaccess file, like it’s use in the earliest versions of the HTTP Server- NCSA’s HTTPd, which BTW, became known as Apache HTTP. So you could easily say that htaccess files predates Apache itself.
Once I discovered what .htaccess files could do towards helping me enumerate and exploit security vulnerabilities even on big shared-hosts I focused all my research into .htaccess files, meaning I was reading the venerable Apache HTTP Source code 24/7! I compiled every released version of the Apache Web Server, ever, even NCSA’s, and focused on enumerating the most powerful htaccess directives. Good times! Because my focus was on protocol/file/network vulnerabilites instead of web dev I built up a nice toolbox of htaccess tricks to do unusual things. When I switched over to webdev in 2005 I started using htaccess for websites, not research. I documented most of my favorites and rewrote the htaccess guide for webdevelopers. After some great encouragement on various forums and nets I decided to start a blog to share my work with everyone, AskApache.com was registered, I published my guide, and it was quickly plagiarized and scraped all over the net. Information is freedom, and freedom is information, so this blog has the least restrictive copyright for you. Feel free to modify, copy, republish, sell, or use anything on this site ;)
Tags: .htaccess examples, 301 Redirect, 302 Redirect, 401, 403 Forbidden, 404 Not Found, 500, 503, admin, Advanced, Apache, Apache Htaccess, apache ssl, askapache, ASP, authorization, Backups, Bandwidth, bash, Blocking, Boot, Cache, Cache-Control, caching, cheatsheet, chmod, code snippets, compression, Cookies, CSS, debugging, DreamHost, Email, error log, errordocument, Etags, Examples, experiments, feed, FeedBurner, File System, FilesMatch, filesystem, Firefox, Flash, Forms, GET, Google, Hacking, hotlinking, HowTo, Htaccess, htaccess files, htaccess guide, htaccess rewrite, htaccess tricks, htaccess tutorial, Htpasswd, HTTP Error, HTTP Headers, HTTP-EQUIV, httpd, httpd.conf, HTTPS SSL, hyper text transfer protocol, If-Modified-Since, Javascript, Last-Modified, Linux, Login, Logs, mad skills, mod_include, mod_python, Mod_Rewrite, Mod_Rewrite examples, Mod_Security, Mod_Setenvif, mysql, Nice, nsa, password, password protection, PDF, Performance, Perl, PHP, php.ini, phpinfo, Port, post, Powweb, Prompt, Python, ram, Redirect, Redirection, Request Method, Rewrite Tricks, rewritecond, rewriterule, Robot, robots, Sample .htaccess, Scripts, Security, SEO, seo secrets, server, server config, servers, SetEnvIf, Shell, Socket, Source Code, SPEED, SSH, SSI, stat, SymLinks, trick, tutorial, ultimate htaccess, Username, Web Hosting, WordPress
Posted in Apache, Apache Modules, Cache, DreamHost, Featured, Google, Hacking, Htaccess, Linux Unix BSD, Mod_Rewrite, SEO, Security, Web Design, Web Hosting, Web Tools, Webmaster, WordPress | Published on 01/10/2009 |66 Comments »
Mod_Security rivals Mod_Rewrite in the amount of features it provides. I decided to go ahead and post what I learned about it today, even though its tough to give away such awesome htaccess and apache tricks.. Learn how to control spam once and for all, conditionally log/deny/allow/redirect requests based on IP, username, etc.. Mod_Security is so fine!
Tags: 301 Redirect, 401, 403 Forbidden, 500, 503, admin, Ajax, Apache, apache ssl, askapache, authorization, Bandwidth, Cache, Cache-Control, caching, Cookies, debugging, DreamHost, Email, error log, errordocument, Examples, FilesMatch, GET, Hacking, Htaccess, htaccess files, htaccess guide, htaccess tricks, htaccess tutorial, Htpasswd, HTTP Headers, HTTP Status Codes, httpd, httpd.conf, HTTPS SSL, Login, Logs, Mod_Rewrite, Mod_Rewrite examples, Mod_Security, nsa, password, password protection, Perl, PHP, Port, post, Prompt, ram, Redirect, Request Method, Rewrite Tricks, rewritecond, rewriterule, Robot, robots, Scanners, Security, SEO, server, servers, SetEnvIf, Shell, SPEED, SSI, stat, trick, tutorial, Username, WordPress
Posted in Apache, Apache Modules, DreamHost, Featured, Htaccess, Security, Web Hosting, Webmaster | Published on 04/23/2008 |8 Comments »
How I was able to preload many flash flv and swf files on one of my clients sites that has a lot of online video and relatively small traffic. Their site visitors would usually watch 3-10 videos per visit and so to make the videos load almost instantly on every page I came up with a way to preload the top 10 .flv files and the swf flv player files as soon as the visitor successfully started watching the 1st video. Of course I also setup .htaccess caching on the server so that once they downloaded the files into their cache they would never request them from the server again. I was having fun with this so its pretty funky and uses some really cool combinations of javascript, swf preloader from xml, css classes to help automate it all..
Tags: 404 Not Found, Ajax, Apache, askapache, Backups, Bandwidth, Boot, Cache, Cache-Control, caching, console, Cookies, CSS, FilesMatch, Flash, Flash Actionscript, Google, Htaccess, HTTP Headers, Javascript, Logs, Mod_Rewrite, mysql, PDF, PHP, preload, ram, Rewrite Tricks, server, Shell, SPEED, SSI, stat, tutorial, Web Development, Wireshark
Posted in Cache, Flash, Htaccess, Web Design | Published on 02/04/2008 |4 Comments »
Apache .htaccess Directives and Loaded Modules allowed on DreamHost Apache Server 2 Setups.
Tags: admin, Apache, askapache, authorization, Bandwidth, Cache, Cache-Control, Dig, DNS, DreamHost, Email, error log, errordocument, Etags, FilesMatch, filesystem, HowTo, Htaccess, HTTP Error, HTTP Headers, httpd, httpd.conf, HTTPS SSL, Linux, Logs, mod_include, Mod_Rewrite, Mod_Security, Mod_Setenvif, mysql, Performance, Port, ram, Redirect, Redirection, Request Method, Rewrite Tricks, Scripts, Security, server, server config, Server Side Includes, servers, SetEnvIf, Shell, Socket, SPEED, SSI, stat, Web Hosting
Posted in Apache, Apache Modules, DreamHost, Htaccess | Published on 11/23/2007 |No Comments »
Use the Apache module mod_deflate to compress your static .css and .js files, speeding your site up like crazy!
Tags: Apache, askapache, Bandwidth, Cache, Cache-Control, caching, compression, CSS, Etags, expires header, FilesMatch, GET, Htaccess, HTTP Headers, httpd, httpd.conf, HTTPS SSL, Last-Modified, Performance, SPEED, SSI, stat
Posted in Apache, Cache, DreamHost, Htaccess | Published on 09/05/2007 |19 Comments »