mirror of https://github.com/phanan/htaccess.git
Merge branch 'alexweissman-master'
This commit is contained in:
commit
b9a6f3584d
17
README.md
17
README.md
|
@ -17,7 +17,9 @@ What I'm doing here is mostly collecting useful snippets from all over the inter
|
||||||
- [Force HTTPS Behind a Proxy](#force-https-behind-a-proxy)
|
- [Force HTTPS Behind a Proxy](#force-https-behind-a-proxy)
|
||||||
- [Force Trailing Slash](#force-trailing-slash)
|
- [Force Trailing Slash](#force-trailing-slash)
|
||||||
- [Redirect a Single Page](#redirect-a-single-page)
|
- [Redirect a Single Page](#redirect-a-single-page)
|
||||||
|
- [Alias a Single Directory](#alias-a-single-directory)
|
||||||
- [Redirect an Entire Site](#redirect-an-entire-site)
|
- [Redirect an Entire Site](#redirect-an-entire-site)
|
||||||
|
- [Alias Clean URLs](#alias-clean-urls)
|
||||||
- [Security](#security)
|
- [Security](#security)
|
||||||
- [Deny All Access](#deny-all-access)
|
- [Deny All Access](#deny-all-access)
|
||||||
- [Deny All Access Except Yours](#deny-all-access-except-yours)
|
- [Deny All Access Except Yours](#deny-all-access-except-yours)
|
||||||
|
@ -94,12 +96,27 @@ Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
|
||||||
```
|
```
|
||||||
[Source](http://css-tricks.com/snippets/htaccess/301-redirects/)
|
[Source](http://css-tricks.com/snippets/htaccess/301-redirects/)
|
||||||
|
|
||||||
|
### Alias a Single Directory
|
||||||
|
``` apacheconf
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule ^source-directory/(.*) target-directory/$1
|
||||||
|
```
|
||||||
|
|
||||||
### Redirect an Entire Site
|
### Redirect an Entire Site
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
Redirect 301 / http://newsite.com/
|
Redirect 301 / http://newsite.com/
|
||||||
```
|
```
|
||||||
This way does it with links intact. That is `www.oldsite.com/some/crazy/link.html` will become `www.newsite.com/some/crazy/link.html`. This is extremely helpful when you are just "moving" a site to a new domain. [Source](http://css-tricks.com/snippets/htaccess/301-redirects/)
|
This way does it with links intact. That is `www.oldsite.com/some/crazy/link.html` will become `www.newsite.com/some/crazy/link.html`. This is extremely helpful when you are just "moving" a site to a new domain. [Source](http://css-tricks.com/snippets/htaccess/301-redirects/)
|
||||||
|
|
||||||
|
### Alias "Clean" URLs
|
||||||
|
This snippet lets you use "clean URLs" -- those without a PHP extension, e.g. `example.com/users` instead of `example.com/users.php`.
|
||||||
|
``` apacheconf
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{SCRIPT_FILENAME} !-d
|
||||||
|
RewriteRule ^([^.]+)$ $1.php [NC,L]
|
||||||
|
```
|
||||||
|
[Source](http://www.abeautifulsite.net/access-pages-without-the-php-extension-using-htaccess/)
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
### Deny All Access
|
### Deny All Access
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
|
|
Loading…
Reference in New Issue