2
0
Fork 0
mirror of https://github.com/phanan/htaccess.git synced 2018-11-08 13:39:40 +01:00

Merge pull request #35 from decanus/master

Remove trailing slashes
This commit is contained in:
Phan An 2015-02-19 10:34:11 +07:00
commit 54e5bfe947

View file

@ -17,6 +17,7 @@ What I'm doing here is mostly collecting useful snippets from all over the inter
- [Force HTTPS](#force-https)
- [Force HTTPS Behind a Proxy](#force-https-behind-a-proxy)
- [Force Trailing Slash](#force-trailing-slash)
- [Remove Trailing Slash](#remove-trailing-slash)
- [Redirect a Single Page](#redirect-a-single-page)
- [Alias a Single Directory](#alias-a-single-directory)
- [Alias Paths to Script](#alias-paths-to-script)
@ -101,6 +102,11 @@ RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
```
### Remove Trailing Slash
``` apacheconf
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
```
### Redirect a Single Page
``` apacheconf
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html