You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
greenkeeper[bot]
3e81fc604c
|
6 years ago | |
---|---|---|
src | 9 years ago | |
test | 8 years ago | |
.gitignore | 9 years ago | |
.npmignore | 9 years ago | |
.travis.yml | 8 years ago | |
LICENSE | 8 years ago | |
README.md | 8 years ago | |
package.json | 6 years ago |
README.md
htconvert
Convert .htaccess redirects to nginx.conf redirects.
Install
npm install --global htconvert
Usage
$ cat .htaccess | htconvert > nginxRedirects.conf
# or
$ htconvert -f .htaccess > nginxRedirects.conf
.htaccess
# Frontend Redirects
Redirect 301 /deleted-page/ https://website.com/new-page/
Redirect 302 /new-feature/ https://website.com/coming-soon/
# Admin Redirects
Redirect 301 /admin/ https://website.com/?login=true
nginxRedirects.conf
# Frontend Redirects
location /deleted-page/ {
return 301 https://website.com/new-page/;
}
location /new-feature/ {
return 302 https://website.com/coming-soon/;
}
# Admin Redirects
location /admin/ {
return 301 https://website.com/?login=true;
}
Options
$ htconvert --help
Usage: htconvert [options]
Options:
-h, --help output usage information
-V, --version output the version number
-f, --file [.htaccess] File containing .htaccess redirects
Node
This is also usable as a node module
npm install --save htconvert
var htconvert = require('htconvert');
var htaccess = 'Redirect 301 /deleted-page/ https://website.com/new-page/';
htconvert(htaccess);
// `location /deleted-page/ {
// return 301 https://website.com/new-page/;
// }`
License
MIT © Luke Childs