background preloader

Server maintenance

Facebook Twitter

HTTP Server Version 2.5 Documentation. The htaccess Rules for all WordPress Permalinks. Update 2012/07/15 all code updated with the new .htaccess rules (changed in WP 3.0). The code in this article should work with all versions of WordPress. </update> I recently performed a series of tests on a fresh installation of WordPress 2.8.6 to determine the exact htaccess rewrite rules that WordPress writes to its htaccess file for various permalink configurations. Under the WP admin option menu, WordPress lists four choices for permalink structure: Default: The "default" option is to not use permalinks. For the test, we began with the common "date and name based" permalink configuration. The results indicate conclusively that WordPress uses the exact same set of htaccess rules for all permalink configurations.

Without further ado, the htaccess rules for all WordPress permalinks1 are precisely either #1 or #2: [ #1 ] If WordPress installed in the root directory » [ #2 ] If WordPress installed in a subdirectory called "foo" » Stupid htaccess Tricks. Welcome to Perishable Press! This article, Stupid htaccess Tricks, covers just about every htaccess “trick” in the book, and is easily the site’s most popular offering. In addition to this htaccess article, you may also want to explore the rapidly expanding htaccess tag archive.

Along with all things htaccess, Perishable Press also focuses on (X)HTML, CSS, PHP, JavaScript, security, and just about every other aspect of web design, blogging, and online success. If these topics are of interest to you, I encourage you to subscribe to Perishable Press for a periodic dose of online enlightenment ;) General Information [ ^ ] .htaccess Definition 1 ^ Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. Commenting .htaccess Code ^ Comments are essential to maintaining control over any involved portion of code. Important Notes for .htaccess Noobs ^ As a configuration file, .htaccess is very powerful. Performance Issues ^ [S=x] [E=variable:value] Stupid htaccess Tricks. Welcome to Perishable Press! This article, Stupid htaccess Tricks, covers just about every htaccess “trick” in the book, and is easily the site’s most popular offering.

In addition to this htaccess article, you may also want to explore the rapidly expanding htaccess tag archive. Along with all things htaccess, Perishable Press also focuses on (X)HTML, CSS, PHP, JavaScript, security, and just about every other aspect of web design, blogging, and online success. If these topics are of interest to you, I encourage you to subscribe to Perishable Press for a periodic dose of online enlightenment ;) General Information [ ^ ] .htaccess Definition 1 ^ Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files.

Commenting .htaccess Code ^ Comments are essential to maintaining control over any involved portion of code. Important Notes for .htaccess Noobs ^ As a configuration file, .htaccess is very powerful. Performance Issues ^ [S=x] [E=variable:value] MOD_REWRITE for Dummies. This article is not a complete guide to Apache's mod_rewrite neither to .htaccess.

Its purpose is to help you - the webmaster - to create "mod_rewriten" versions of your dynamic webpages even if you have limited technical knowledge. I won't show you all the tips-and-tricks - my aim is to bring all the complexity of the Apache's documentation to 1-2 pages of human language - easy and fast. What is mod_rewrite? Mod_rewrite is Apache extension which allows you to "rewrite" the URLs of your web pages. If your server supports this technology (most Linux webhosts do nowadays) you are able to rewrite virtually any URL into anything you like. Www.mywebsite.com/index.php? This can easy be 'translated' into www.mywebsite.com/par1/par2/par3 Why mod_rewrite? Search engine optimization - there are a lot of debates on this topic, but it is still true that the static-looking links rank better than the dynamic ones.

How to use it? Lets start: Options +FollowSymLinksRewriteEngine on What does all that mean? 301 Redirect Htaccess Examples. You are here: home 301 redirects When updating any website with a new page structure, re-naming page URL's or changing the path of web pages by adding folders or altering folder names, many webmasters forget or simply don’t appreciate the SEO benefits of using Mod Rewrite or simple "301 redirects" to redirect old pages to new. A different, but equally popular application for 301 redirects is to redirect all visitors to a certain website to another domain, either on a page by page basis or to redirect all pages on an old unused domain to a single page on a new domain - the homepage for example. 301's are often referred to as "Redirect Permanent", so as the name implies they are used to permanently redirect one web page to another - and are recommended by Google as the best method of implementing web page redirects.

HTACCESS File SEO Benefits of 301 Redirects Usability Benefits Mod Rewrite Procedure & 301 Redirect Examples Mod Rewrite rules are applied using an HTACCESS file. Wildcard Redirects. URL Rewriting for Beginners. A beginner's guide to URL rewriting, with plenty of examples. Introduction URL rewriting can be one of the best and quickest ways to improve the usability and search friendliness of your site. It can also be the source of near-unending misery and suffering. Definitely worth playing carefully with it - lots of testing is recommended.

There are several other guides on the web already, that may suit your needs better than this one. Apache URL Rewriting Guide - The best guide around Before reading on, you may find it helpful to have the mod_rewrite cheat sheet and/or the regular expressions cheat sheet handy. What is "URL Rewriting"?

Most dynamic sites include variables in their URLs that tell the site what information to show the user. The problems with this kind of URL structure are that the URL is not at all memorable. Clearly a much cleaner and shorter URL. Platforms and Tools . Rewrite. Available Languages: en | fr Summary This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule, to provide a really flexible and powerful URL manipulation mechanism.

The URL manipulations can depend on various tests, of server variables, environment variables, HTTP headers, or time stamps. Even external database lookups in various formats can be used to achieve highly granular URL matching. This module operates on the full URLs (including the path-info part) both in per-server context (httpd.conf) and per-directory context (.htaccess) and can generate query-string parts on result. Further details, discussion, and examples, are provided in the detailed mod_rewrite documentation. Quoting Special Characters Environment Variables Example Rewriting in Virtual Hosts RewriteEngine On RewriteOptions Inherit RewriteBase Directive.

Apache mod_rewrite. Mod_rewrite provides a way to modify incoming URL requests, dynamically, based on regular expression rules. This allows you to map arbitrary URLs onto your internal URL structure in any way you like. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests: server variables, environment variables, HTTP headers, time stamps, external database lookups, and various other external programs or handlers, can be used to achieve granular URL matching.

Rewrite rules can operate on the full URLs, including the path-info and query string portions, and may be used in per-server context (httpd.conf), per-virtualhost context (<VirtualHost> blocks), or per-directory context (.htaccess files and <Directory> blocks). Since mod_rewrite is so powerful, it can indeed be rather complex. Simple 301 redirect and Wordpress htaccess rules Apache Web Server forum at WebmasterWorld. URL Rewriting Guide.