Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

htconvert

> DevOps
Open source

Convert .htaccess redirects to nginx.conf redirects

193 stars0 likes3 views
WebsiteGitHub

About

Convert .htaccess redirects to nginx.conf redirects

htconvert

Convert .htaccess redirects to nginx.conf redirects.

Install

bash
npm install --global htconvert

Usage

bash
$ 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

bash
$ 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

bash
npm install --save htconvert
javascript
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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptapacheclinginxsysadmin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理