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] 24d991b600 Update ava to the latest version 🚀 (#9) 7 years ago
src Neaten htaccess check 9 years ago
test Update filepaths to work with latest AVA 8 years ago
.gitignore Add babel 9 years ago
.npmignore Add babel 9 years ago
.travis.yml Don't send email on success 8 years ago
LICENSE Add LICENSE file 8 years ago
README.md Add npm downloads to readme 8 years ago
package.json Update ava to the latest version 🚀 (#9) 7 years ago

README.md

htconvert

Convert .htaccess redirects to nginx.conf redirects.

Build Status Coverage Status npm npm

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