
.htaccess Editor API
Web Development
Free .htaccess editor with AI assistance. Create and modify Apache server configurations using plain English.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
100 requests per minute
Endpoints
1 endpoint available
Overview
The .htaccess Editor API uses AI to create and modify Apache server configuration files from natural language instructions.
Common Use Cases
- Redirect HTTP to HTTPS (force SSL)
- Block specific IP addresses
- Set custom error pages (404, 500, etc.)
- Enable Gzip compression
- Block hotlinking of images
- Password protect directories
- URL rewriting and redirects
- Cache control headers
Input Options
- Create new .htaccess from scratch
- Modify existing .htaccess content
Endpoints
POST
/v1/tools/htaccess-editorCreate or modify .htaccess file content
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| currentHtaccess | string | Optional | Existing .htaccess content to modify (optional, leave empty to create new) |
| instruction | string | Required | Natural language description of the changes you want (e.g., "Redirect all HTTP to HTTPS") |
Response Example
{
"success": true,
"data": {
"result": "RewriteEngine On\nRewriteCond %{HTTPS} off\nRewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]",
"explanation": "This .htaccess file was generated based on your current content and requested changes."
}
}Error Codes
400
Bad Request - Missing instruction401
Unauthorized - Invalid or missing API key429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
# Create new .htaccess
curl -X POST https://api.opentools.ca/v1/tools/htaccess-editor \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Redirect all HTTP traffic to HTTPS and enable Gzip compression for text files"
}'
# Modify existing .htaccess
curl -X POST https://api.opentools.ca/v1/tools/htaccess-editor \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"currentHtaccess": "RewriteEngine On",
"instruction": "Add rules to block IP address 192.168.1.100"
}'