htaccess

FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Posts Tagged ‘htaccess’

Advanced WordPress wp-config.php Tweaks

Saturday, October 3rd, 2009

The bottom line for this article is that I want to make WordPress as fast, secure, and easy to install, run, and manage because I am using it more and more for client production sites, I will work for days in order to solve an issue so that I never have to spend time on that issue again. Time is money in this industry and that is ultimately (time) what there is to gain by tweaking WordPress.

Note: I spent no time on readability, this is primarily a read the code and figure it out article.. This is for advanced users looking for a reference or discussion and for those of you looking to advance. Feedback would be great if you make it that far..


Crazy Advanced Mod_Rewrite Tutorial

Friday, September 11th, 2009

Note: Extremely ILL Content
Find the key to unlocking mod_rewrite and you WILL be sick.. sick with a diamond disease on your wrist!


mod_rewrite Fix for Caching Updated Files

Sunday, August 30th, 2009

Web Developers sometimes use file.ext?v=004 as a version control system to force visitors to use updated files. This is terrible. Instead link to apache-003.css and set it to be cached forever. When you change the file you just change the links to apache-004.css. That eliminates millions of bandwidth and resource robbing If-Modified-Since requests. You only need Apache with mod_rewrite, and 1-10 minutes!


PHP and AJAX shell console

Saturday, June 13th, 2009

PHP AJAX shell console Ever wanted to execute commands on your server through php? Now you can. I’m calling this file (see below) shell.php and it allows you to run commands on your web server with the same permissions that your php executable has.


Advanced Htaccess Demo/Example using Cookies, Headers, Rewrites

Tuesday, March 31st, 2009

Advanced Htaccess NSAWhoa pretty sweet huh? Bet you’ve never seen that before! As I explain the htaccess code that achieves this, keep in mind this is merely one simple application for this code. It’s much more advanced than your basic htaccess trick, notice how this htaccess acts like a php script, very unusual.. I really wanted to share this trick after I created it for one of my clients because this is the tip of the iceberg. Another use would be to display an alternate style sheet depending on a users theme preference. The coolest thing about this example IMHO is that it uses multiple advanced .htaccess ideas in order for it to work, most htaccess code on the net is very singular. This code uses mod_headers to set the Content-Disposition header for forcing a download and uses mod_rewrite to do the rest.


Advanced Htaccess – SSI, ErrorDocuments, DirectoryIndexing SEO

Monday, March 9th, 2009

htaccess directory indexingErrorDocument from .htaccess3-Part article covering practical implementation of 3 advanced .htaccess features. Discover an easy way to boost your SEO the AskApache way (focus on visitors), a tip you might keep and use for life. Get some cool security tricks to use against spammers, crackers, and other nefarious sorts. Take your site’s error handling to the next level, enhanced ErrorDocuments that go beyond 404’s.


Password Protection Plugin Status

Sunday, March 1st, 2009

Apache Security Model - In ColorI wanted to address why the update to the AskApache Password Protection plugin didn’t happen pre-2009 as I had hoped.. Mostly due to my job but I thought I could at least fill you in. Oh and this is going to get very boring very fast, unless you’re ready to rumble in the zone.


Ultimate Htaccess Tutorial for .htaccess files

Saturday, January 10th, 2009

.htaccess tutorial and htaccess sampleThis is not an introduction to .htaccessThis is the evolution of .htaccess… The BEST, the ORIGINAL, the NEWEST, and the most HIGHEST, FLYEST .htaccess tricks I can find.

Originally known as the “Ultimate .htaccess Guide”, its changed over the years by adding new .htaccess tricks and .htaccess examples to it.. I also add my favorite .htaccess links, the best .htaccess articles on AskApache, the coolest .htaccess experiments, the Web’s best .htaccess hacks, and update this article on the regular.


Advanced .htaccess Tricks for Securing Sites

Friday, December 19th, 2008

This is all new, experimental, and very very cool. It literally uses .htaccess techniques to create several virtual “locked gates” that require a specific key to unlock, in a specific order that cannot be bypassed. It uses whitelisting .htaccess tricks to specify exactly what is allowed, instead of trying to specify everything that isn’t allowed. Also, by setting specific cookies/tokens after successfully passing through a gate, we can then require the exact cookie/token from the previous gate, which stops an attacker from skipping or bypassing gates.


.htaccess Plugin Blocks Spam, Hackers, and Password Protects Blog

Saturday, November 22nd, 2008

.htaccess security plugin 2

Well what can I say, other than this is sooo DOPE! Here is a list of the modules this plugin (version 4.7 unreleased) will automatically detect. I compiled the list myself using every module included with any default Apache installation for ALL the versions listed below, 1.3 to 2.2+

Want to know something else I’m including in this plugin? For each and every module that is detected, this plugin can then detect ALL of the modules .htaccess Directives! For instance, RewriteRule, AccessFileName, AddHandler, etc.. are each a directive belonging to a module that is allowed to be used from within .htaccess files.

Talk about sick.. these tricks have the diamond disease!


.htaccess trick to show Alternate CSS file based on IP

Monday, October 20th, 2008

.htaccess trick to show Alternate CSS file based on IPThis past week I updated my sites apache.css file for a site-redesign. I wanted to make changes to the .css file that only I could see, so that my regular traffic and site-visitors would still see the old version. Here’s the elegant solution I came up with using .htaccess and mod_rewrite that works so well I’m sharing it with all you wonderful and incredible people reading my blog :)


Optimize a Website for Speed, Security, and Easy Management

Saturday, October 18th, 2008

Learn how to setup, configure, secure, optimize, and create a low-maintenance website the AskApache way. I’m piecing together all the hacks, tricks, methods, and ideas discussed throughout this blog and all across Netdom and glueing them all together to show you how to have the most optimized, crazy fastest, and best website setup I can think of.


Mod_Rewrite Variables Cheatsheet

Thursday, September 25th, 2008

We’ve figured out what mod_rewrite variables look like, a cheatsheet of the actual value.


Pimp out your FeedBurner Count

Tuesday, August 19th, 2008

I’ve had a lot of people ask about the FeedBurner FeedCount image on AskApache. Specifically how to set it up with custom messages and different colors each page view… It is pretty sweet..


Preloading .flv and .mp3 files with Flash

Tuesday, August 5th, 2008

Preload/Cache .mp3 .flv files with Flash ActionscriptIf you want to pre-load .flv / .mp3 files into a visitors browser cache using flash, here’s the actionscript I use to do it, and some ideas behind a good javascript implementation using swfobject or ufo.


Securing php.ini and php.cgi with .htaccess

Tuesday, June 24th, 2008

If you have a php.cgi or php.ini file in your /cgi-bin/ directory or other pub directory, try requesting them from your web browser. If your php.ini shows up or worse you are able to execute your php cgi, you’ll need to secure it ASAP. This shows several ways to secure these files, and other interpreters like perl, fastCGI, bash, csh, etc.


Smart HTTP and HTTPS .htaccess Rewrite

Tuesday, April 29th, 2008

This is freaking sweet if you use SSL I promise you! Basically instead of having to check for HTTPS using a RewriteCond %{HTTPS} =on for every redirect that can be either HTTP or HTTPS, I set an environment variable once with the value “http” or “https” if HTTP or HTTPS is being used for that request, and use that env variable in the RewriteRule.


Mod_Security .htaccess tricks

Wednesday, April 23rd, 2008

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!


.Htaccess rewrites, Mod_Rewrite Tricks and Tips

Thursday, April 10th, 2008

htaccess rewrite / Mod_Rewrite Tips and Tricks is as glamorous as it sounds! htaccess rewrite mod_rewrite is just possibly one of the most useful Apache modules and features. The ability to rewrite requests internally as well as externally is extremely powerful.


Blocking Bad Bots and Scrapers with .htaccess

Tuesday, April 8th, 2008

Block Bad RobotWant to block a bad robot or web scraper using .htaccess files? Here are 2 methods that illustrate blocking 436 various user-agents.


Fresh .htaccess Examples: Cookies, Variables, Custom Headers

Saturday, March 29th, 2008

Cookie Manipulation in .htaccess with RewriteRuleFresh .htaccess code for you! Check out the Cookie Manipulation and environment variable usage with mod_rewrite! I also included a couple Mod_Security .htaccess examples. Enjoy!


Speed Tips: Add Cache-Control Headers

Monday, March 10th, 2008

Cache-Control Headers OnUsing Cache-Control headers you can specify which types of proxies can cache certain content, and how long files should be cached.


Instruct Search Engines to come back to site after you finish working on it

Thursday, February 28th, 2008

HTTP Errors, HTTP Timeouts can be prevented with a 503 Service Temporarily UnavailableNifty SEO tip to get Search Engine Bots to check your site every hour until you finish working on it and tell them you are finished.



Redirecting RSS to Feedburner

Monday, January 7th, 2008

FeedBurner, the best syndication company in the worldFeedBurner is so RAD! I love it. Here’s an alternative method to redirect scrapers and feed requests to your feedburner url, in my case, I use Branding by feedburner, which is so hot, taking advantage of CNAMEs in your DNS record.


SetEnvIf and SetEnvIfNoCase Examples

Monday, January 7th, 2008

SetEnv, SetEnvIf, and SetEnvIfNoCase directives conditionally set environment variables accessible by scripts and apache based on HTTP Headers, Variables, and Request information.


HTTP Status Codes and .htaccess ErrorDocuments

Friday, January 4th, 2008

There are a total of 57 HTTP Status Codes recognized by the Apache Web Server. Wouldn’t you like to see what all those headers and their output, ErrorDocuments look like?


301 Redirect Cheatsheet

Thursday, November 29th, 2007

Ultimate Redirect Cheatsheet for multiple programming languages. Redirecting Users with Javascript redirect, meta refresh redirect, and php redirect, also htaccess methods, python, coldfusion, asp, perl, etc.


Speed Tips: Remove Last-Modified Header

Monday, September 10th, 2007

If you remove the Last-Modified and ETag header, you will totally eliminate If-Modified-Since and If-None-Match requests and their 304 Not Modified Responses.


Speed Tips: Add Future Expires Headers

Monday, September 10th, 2007

With Expires HeaderA first-time visitor to your page will make several HTTP requests to download all your sites files, but using the Expires header you make those files cacheable. This avoids unnecessary HTTP requests on subsequent page views.


Redirect index.php to root

Thursday, August 9th, 2007

WordPress blogs show the same duplicate content for http://www.askapache.com/index.php and http://www.askapache.com/. If you’ve read about using a robots.txt file for WordPress SEO, than you already understand this setup results in Duplicate Content penalties being levied against your Blog and Web Site by Search Engines.


Security with Apache htaccess Tutorial

Tuesday, April 10th, 2007

Apache Security tips and tricks for securing Apache Web Servers using htaccess, httpd.conf, and other built-in techniques to thwart attackers. This really should be required reading for any Apache admin or user because these little tricks are so easy to do.


SEO Redirects without mod_rewrite

Tuesday, April 10th, 2007

Web Professionals use mod_rewrite to issue 301 and 302 Redirects for Search Engines. Sometimes you may not have mod_rewrite.c or you want an alternative redirect method. Using mod_alias RedirectMatch you can use REGEX in Redirect commands!


htaccess Tricks for Webmasters

Tuesday, April 10th, 2007

Some of my favorite htaccess examples from some of my favorite .htaccess tutorials. These cut-and-paste ready htaccess code snippets are very useful for website and server administrators.


27 Request Methods for Apache rewritecond htaccess

Tuesday, March 6th, 2007

Have you ever wondered how many REQUEST_METHODS you could use in Apache?

Scan Your Site to see what Request Methods are currently allowed, and fix potential security holes.
Intro
The Request Method, as supplied in the REQUEST_METHOD meta-variable, identifies the processing method to be applied by the script in producing a response.
The script author can choose to implement the methods most appropriate for the particular application.
If the script receives a request with a method it does not support it SHOULD reject it with an error.
List of the 27 Request Methods Recognized by Apache

GET
PUT
POST
DELETE
CONNECT
OPTIONS
TRACE
PATCH
PROPFIND
PROPPATCH
MKCOL
COPY
MOVE
LOCK
UNLOCK
VERSION_CONTROL
CHECKOUT
UNCHECKOUT
CHECKIN
UPDATE
LABEL
REPORT
MKWORKSPACE
MKACTIVITY
BASELINE_CONTROL
MERGE
INVALID

GET
The GET method indicates that the script should produce a document based on the meta-variable values. By convention, the GET method is ’safe’ and ‘idempotent’ and SHOULD NOT have the significance of taking an action other than producing a document.
The meaning of the GET method may be modified and refined by protocol-specific meta-variables.
POST
The POST method is used to request the script perform processing and produce a document based on the data in the request message-body, in addition to meta-variable values. A common use is form submission in HTML [18], intended to initiate processing by the script that has a permanent affect, such a change in a database.
The script MUST check the value of the CONTENT_LENGTH variable before reading the attached message-body, and SHOULD check the CONTENT_TYPE value before processing it.
HEAD
The HEAD method requests the script to do sufficient processing to return the response header fields, without providing a response message-body. The script MUST NOT provide a response message-body for a HEAD request. If it does, then the server MUST discard the message-body when reading the response from the script.
OPTIONS
The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the …


Rewrite underscores to hyphens for SEO URL

Thursday, February 22nd, 2007

Replace underscores in URLs with hyphens using Apache .htaccess.


Sending POST form data with php CURL

Wednesday, February 21st, 2007

CURL Guide for sending POST data form request with PHP and CURL


Serve Alternate Content based on Time

Sunday, February 11th, 2007

TIME_DAY Time RewriteCondTime-dependant rewriting uses mod_rewrite and apache server time variables to display different files depending on the time, while the URL stays the same. An often requested implementation of this is to display a different home page or image depending on if its morning, noon, or night.


Custom PHP.ini tips and tricks

Monday, February 5th, 2007


Related Articles
Good Causes
Newest Posts
Random
Tech Topics

htaccess Guide

Website Speed Tips Series
  1. Turn On Compression
  2. Add Future Expires Header
  3. Add Cache-Control Headers
  4. Turn Off ETags
  5. Remove Last-Modified Header
  6. Use Multiple SubDomains


The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. Tim Berners-Lee



It's very simple - you read the protocol and write the code. -Bill Joy

HTML | DCMI | GRDDL | XOXO | XDMP | XFN | DOM | XML | XHTML 1.1 Strict | CSS 2.1 | W3C | TLDP | WAI | DISA | ICSI | GIAC | SANS RR | GHOST | DEFCON | NIST | DHS CYBER | NIST

↑ TOPExcept where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. HTTPD based on NCSA HTTPd

Site Map | Contact Webmaster | Email AskApache | Glossary | License and Disclaimer | Terms of Service