Skip to content

Commit

Permalink
[Fixed] Fixed a typo in the Retour_StatsModel
Browse files Browse the repository at this point in the history
[Improved] Added a rant about `.htaccess` to the docs
  • Loading branch information
Andrew Welch committed Jul 6, 2016
1 parent e922e96 commit 639a74c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ Retour solves these problems:
2. Retour also gives you the ability to do Dynamic Entry Redirects that allow you to import a piece of legacy data into your entries to use as a key for determining the new URL mapping. In this way, utterly dissimilar URLs can be mapped for redirection effectively.
3. It provides an easy to use GUI that the client can use from Craft's AdminCP, and keeps statistics on the 404 hits (and misses)

### A Word about .htaccess

People using the Apache webserver are familiar with the `.htaccess` file, and may even be using it for redirects. It's very likely that you should not be using `.htaccess` at all; instead you should disable `.htaccess` via `AllowOverride none` and make your configuration changes in your webserver configuration files. From [Apache HTTP Server Tutorial: .htaccess files](https://httpd.apache.org/docs/current/howto/htaccess.html)

There are two main reasons to avoid the use of .htaccess files.

The first of these is performance. When AllowOverride is set to allow the use of .htaccess files, httpd will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, whether or not you actually even use them! Also, the .htaccess file is loaded every time a document is requested.

Further note that httpd must look for .htaccess files in all higher-level directories, in order to have a full complement of directives that it must apply. (See section on how directives are applied.) Thus, if a file is requested out of a directory /www/htdocs/example, httpd must look for the following files:

/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess

And so, for each file access out of that directory, there are 4 additional file-system accesses, even if none of those files are present. (Note that this would only be the case if .htaccess files were enabled for /, which is not usually the case.)

In the case of RewriteRule directives, in .htaccess context these regular expressions must be re-compiled with every request to the directory, whereas in main server configuration context they are compiled once and cached. Additionally, the rules themselves are more complicated, as one must work around the restrictions that come with per-directory context and mod_rewrite. Consult the Rewrite Guide for more detail on this subject.

As you can see, avoiding the use of `.htaccess` completely is best if at all possible, and especially avoid it for RewriteRule directives, such as 404 rewrites.

## Dynamic Entry Redirects

Expand Down Expand Up @@ -157,10 +177,12 @@ Some things to do, and ideas for potential features:

## Retour Changelog

### 1.0.13 -- 2016.07.10
### 1.0.13 -- 2016.07.06

* [Added] Adds support for locales in the automatic redirect that is created when a slug is changed for an entry
* [Improved] Retour will no longer let you save a static redirect with an empty destinationURL
* [Fixed] Fixed a typo in the Retour_StatsModel
* [Improved] Added a rant about `.htaccess` to the docs
* [Improved] Updated the README.md

### 1.0.12 -- 2016.07.04
Expand Down
2 changes: 1 addition & 1 deletion models/Retour_StatsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function defineAttributes()
return array_merge(parent::defineAttributes(), array(
'redirectSrcUrl' => array(AttributeType::String, 'default' => ''),
'referrerUrl' => array(AttributeType::String, 'default' => ''),
'hitCount' => array(AttributeType::Number, 'default' => 0)
'hitCount' => array(AttributeType::Number, 'default' => 0),
'hitLastTime' => array(AttributeType::DateTime, 'default' => DateTimeHelper::currentTimeForDb() ),
'handledByRetour' => array(AttributeType::Bool, 'default' => false ),
));
Expand Down
4 changes: 3 additions & 1 deletion releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{
"version": "1.0.13",
"downloadUrl": "https://github.com/nystudio107/retour/archive/master.zip",
"date": "2016-07-10T12:00:00-05:00",
"date": "2016-07-06T12:00:00-05:00",
"notes": [
"[Added] Adds support for locales in the automatic redirect that is created when a slug is changed for an entry",
"[Improved] Retour will no longer let you save a static redirect with an empty destinationURL",
"[Fixed] Fixed a typo in the Retour_StatsModel",
"[Improved] Added a rant about `.htaccess` to the docs",
"[Improved] Updated the README.md"
]
},
Expand Down

0 comments on commit 639a74c

Please sign in to comment.