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

Merge pull request #17 from lukedmor/master

Alias Paths to Script
This commit is contained in:
Phan An 2015-02-11 11:33:56 +08:00
commit a5021b733e

View File

@ -18,6 +18,7 @@ What I'm doing here is mostly collecting useful snippets from all over the inter
- [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) - [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](#redirect-an-entire-site)
- [Alias Clean URLs](#alias-clean-urls) - [Alias Clean URLs](#alias-clean-urls)
- [Security](#security) - [Security](#security)
@ -103,6 +104,16 @@ RewriteEngine On
RewriteRule ^source-directory/(.*) target-directory/$1 RewriteRule ^source-directory/(.*) target-directory/$1
``` ```
### Alias Paths To Script
``` apacheconf
RewriteEngine On
RewriteRule ^$ index.fcgi/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]
```
This example has an `index.fcgi` file in some directory, and any requests within that directory that fail to resolve a filename/directory will be sent to the `index.fcgi` script. It's good if you want `baz.foo/some/cool/path` to be handled by `baz.foo/index.fcgi` (which also supports requests to `baz.foo`) while maintaining `baz.foo/css/style.css` and the like.
### Redirect an Entire Site ### Redirect an Entire Site
``` apacheconf ``` apacheconf
Redirect 301 / http://newsite.com/ Redirect 301 / http://newsite.com/