Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukechilds/htconvert
Convert .htaccess redirects to nginx.conf redirects
https://github.com/lukechilds/htconvert
apache cli nginx sysadmin
Last synced: about 1 month ago
JSON representation
Convert .htaccess redirects to nginx.conf redirects
- Host: GitHub
- URL: https://github.com/lukechilds/htconvert
- Owner: lukechilds
- License: mit
- Created: 2016-06-02T17:37:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-11T09:22:35.000Z (almost 5 years ago)
- Last Synced: 2024-06-19T03:04:10.564Z (3 months ago)
- Topics: apache, cli, nginx, sysadmin
- Language: JavaScript
- Size: 50.8 KB
- Stars: 189
- Watchers: 9
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-apps - htconvert - Convert .htaccess redirects to nginx.conf redirects. (Development / Devops)
- fucking-awesome-cli-apps - htconvert - Convert .htaccess redirects to nginx.conf redirects. (Development / Devops)
README
# htconvert
> Convert .htaccess redirects to nginx.conf redirects.
[![Build Status](https://travis-ci.org/lukechilds/htconvert.svg?branch=master)](https://travis-ci.org/lukechilds/htconvert)
[![Coverage Status](https://coveralls.io/repos/github/lukechilds/htconvert/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/htconvert?branch=master)
[![npm](https://img.shields.io/npm/dt/htconvert.svg)](https://www.npmjs.com/package/htconvert)
[![npm](https://img.shields.io/npm/v/htconvert.svg)](https://www.npmjs.com/package/htconvert)## Install
```shell
npm install --global htconvert
```## Usage
```shell
$ cat .htaccess | htconvert > nginxRedirects.conf
# or
$ htconvert -f .htaccess > nginxRedirects.conf
````.htaccess`
```apacheconf
# 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
```shell
$ htconvert --helpUsage: 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
```shell
npm install --save htconvert
``````js
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