mirror of
https://github.com/phanan/htaccess.git
synced 2018-11-08 13:39:40 +01:00
Added reverse proxy configuration example
This commit is contained in:
parent
424cf96c54
commit
1aa0ff5480
1 changed files with 23 additions and 2 deletions
25
README.md
25
README.md
|
@ -1,5 +1,5 @@
|
|||
# .htaccess Snippets
|
||||
A collection of useful .htaccess snippets, all in one place. I decided to create this repo after getting so tired (and bored) with Googling everytime there's a need of forcing `www` for my new website.
|
||||
A collection of useful .htaccess, all in one place. I decided to create this repo after getting so tired (and bored) with Googling everytime there's a need of forcing `www` for my new website.
|
||||
|
||||
**Disclaimer**: While dropping the snippet into an `.htaccess` file is most of the time sufficient, there are cases when certain modifications might be required. Use with your own risks.
|
||||
|
||||
|
@ -14,6 +14,7 @@ A collection of useful .htaccess snippets, all in one place. I decided to create
|
|||
- [Force Trailing Slash](#force-trailing-slash)
|
||||
- [Redirect a Single Page](#redirect-a-single-page)
|
||||
- [Redirect an Entire Site](#redirect-an-entire-site)
|
||||
- [Reverse Proxy](#reverse-proxy)
|
||||
- [Security](#security)
|
||||
- [Deny All Access](#deny-all-access)
|
||||
- [Deny All Access Except Yours](#deny-all-access-except-yours)
|
||||
|
@ -88,6 +89,26 @@ 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/)
|
||||
|
||||
### Reverse Proxy
|
||||
``` apacheconf
|
||||
NameVirtualHost *:80
|
||||
|
||||
<VirtualHost *>
|
||||
ServerAdmin me@mydomain.com
|
||||
ServerName dev.mydomain.com
|
||||
ProxyPreserveHost On
|
||||
|
||||
# setup the proxy
|
||||
<Proxy *>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Proxy>
|
||||
ProxyPass / http://localhost:8888/
|
||||
ProxyPassReverse / http://localhost:8888/
|
||||
</VirtualHost>
|
||||
```
|
||||
[Source](http://serverfault.com/questions/195611/how-do-i-redirect-subdomains-to-a-different-port-on-the-same-server)
|
||||
|
||||
## Security
|
||||
### Deny All Access
|
||||
``` apacheconf
|
||||
|
@ -335,4 +356,4 @@ AddDefaultCharset utf-8
|
|||
# Force UTF-8 for a number of file formats
|
||||
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
|
||||
```
|
||||
[Source](http://h5bp.com)
|
||||
[Source](http://h5bp.com)
|
||||
|
|
Loading…
Reference in a new issue