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

Add Redirect an Entire Site without Links section

This commit is contained in:
Dany Maillard 2016-07-08 20:28:14 +02:00 committed by GitHub
parent 0caec9ddce
commit 1e4fe616e0

View File

@ -22,7 +22,8 @@ What we are doing here is mostly collecting useful snippets from all over the in
- [Redirect Using RedirectMatch](#redirect-using-redirectmatch)
- [Alias a Single Directory](#alias-a-single-directory)
- [Alias Paths to Script](#alias-paths-to-script)
- [Redirect an Entire Site](#redirect-an-entire-site)
- [Redirect an Entire Site with Links](#redirect-an-entire-site-with-links)
- [Redirect an Entire Site without Links](#redirect-an-entire-site-without-links)
- [Alias "Clean" URLs](#alias-clean-urls)
- [Security](#security)
- [Deny All Access](#deny-all-access)
@ -166,12 +167,18 @@ RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]
```
This is a less efficient version of the FallbackResource directive (because using `mod_rewrite` is more complex than just handling the `FallbackResource` directive), but its also more flexible.
### Redirect an Entire Site
### Redirect an Entire Site with Links
``` apacheconf
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/)
### Redirect an Entire Site without Links
``` apacheconf
RewriteEngine On
RewriteRule ^(.*)$ http://newsite.com/
```
### 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