Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Redirect an Entire Site without Links section #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 it’s 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
Expand Down