From 0b8361818984811068ba2cc3ae9677f232c5c1d8 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 26 Aug 2015 01:35:33 +0200 Subject: [PATCH] Remove redundant snippet, simplify title of the remaining one follow-up to #64 --- README.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README.md b/README.md index 0fed4e5..0a80d4b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ What we are doing here is mostly collecting useful snippets from all over the in - [Force HTTPS Behind a Proxy](#force-https-behind-a-proxy) - [Force Trailing Slash](#force-trailing-slash) - [Remove Trailing Slash](#remove-trailing-slash) - - [Remove Trailing Slash from Arbitrary Paths](#remove-trailing-slash-from-arbitrary-paths) - [Redirect a Single Page](#redirect-a-single-page) - [Redirect Using RedirectMatch](#redirect-using-redirectmatch) - [Alias a Single Directory](#alias-a-single-directory) @@ -117,17 +116,11 @@ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] ``` ### Remove Trailing Slash -``` apacheconf -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.*)/$ /$1 [R=301,L] -``` - -### Remove Trailing Slash from Arbitrary Paths This snippet will redirect paths ending in slashes to their non-slash-terminated counterparts (except for actual directories), e.g. `http://www.example.com/blog/` to `http://www.example.com/blog`. This is important for SEO, since it’s [recommended](http://overit.com/blog/canonical-urls) to have a canonical URL for every page. ``` apacheconf RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ -RewriteRule ^ %1 [L,R=301] +RewriteRule ^ %1 [R=301,L] ``` [Source](https://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url#27264788)