.htaccess Compatibility Module - Seamless Apache to OpenLiteSpeed Migration | CyberPanel
🚀 Now With PHP Configuration Support!

Your .htaccess Files
Finally Work with OpenLiteSpeed

Stop rewriting Apache rules. Stop breaking sites during migration.
PHP config, headers, redirects, access control - everything works instantly.

😫 Without This Module
  • Hours spent rewriting Apache rules
  • PHP settings don't work in .htaccess
  • Broken sites after migration
  • Security headers don't work
  • Redirects break completely
  • Cache headers ignored
🎉 With This Module
  • One-command installation
  • PHP settings work perfectly
  • Works instantly on upload
  • All security headers work
  • Redirects work with regex
  • Complete Apache compatibility
5 min
Average Setup Time
100%
Apache Compatible
98%+
.htaccess Coverage
<0.5ms
Performance Overhead
24/7
Support Available
How It Works

Your Existing .htaccess Just Works

No changes needed. Upload and it works.

Before Module ❌ Doesn't Work
# Your Apache .htaccess file
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
RequestHeader set X-Forwarded-Proto "https"

# PHP Configuration
php_value memory_limit 768M
php_value upload_max_filesize 150M
php_flag display_errors On

SetEnv APPLICATION_ENV production
SetEnvIf User-Agent ".*Mobile.*" mobile_device

ErrorDocument 404 /404.html

Order deny,allow
Deny from all
Allow from 192.168.1.0/24

Redirect 301 /old /new
RedirectMatch 301 ^/blog/(.*)$ /news/$1

ExpiresActive On
ExpiresByType image/jpeg A31557600

<FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=2592000"
</FilesMatch>

# Result: None of this works in OpenLiteSpeed!
After Module ✅ Works Perfectly
# Same exact .htaccess file
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
RequestHeader set X-Forwarded-Proto "https"

# PHP Configuration - NOW WORKS!
php_value memory_limit 768M
php_value upload_max_filesize 150M
php_flag display_errors On

SetEnv APPLICATION_ENV production
SetEnvIf User-Agent ".*Mobile.*" mobile_device

ErrorDocument 404 /404.html

Order deny,allow
Deny from all
Allow from 192.168.1.0/24

Redirect 301 /old /new
RedirectMatch 301 ^/blog/(.*)$ /news/$1

ExpiresActive On
ExpiresByType image/jpeg A31557600

<FilesMatch "\.(css|js)$">
    Header set Cache-Control "max-age=2592000"
</FilesMatch>

# Result: Everything works instantly, including PHP config!
⚡ Breakthrough Achievement

PHP Configuration Now Works in .htaccess

We achieved what was previously considered impossible in OpenLiteSpeed - full php_value and php_flag support. Configure PHP settings per directory without editing php.ini or restarting PHP.

768M
Memory Limit
150M
Upload Size
600s
Max Execution
28+
PHP Directives
# Just add to your .htaccess - works instantly!
php_value memory_limit 768M
php_value upload_max_filesize 150M
php_value post_max_size 150M
php_value max_execution_time 600
php_flag display_errors On
php_value date.timezone "America/New_York"
php_admin_flag allow_url_fopen Off
No php.ini editing
No PHP restart needed
Per-directory control
Features

Everything You Need for Smooth Migration

Complete Apache compatibility including PHP configuration

Instant Activation

No configuration needed. Install once and all your .htaccess files start working immediately across all sites.

🛡️

Security Headers

All your security headers work perfectly. X-Frame-Options, CSP, HSTS - everything functions as expected.

🚫

Access Control

IP whitelisting, blacklisting, and network restrictions work exactly like Apache. Protect your admin areas effortlessly.

📄

Custom Error Pages

Your custom 404, 500, and other error pages display properly. No more broken error handling.

🔄

Auto-Updates

Detects changes to .htaccess files automatically. No need to restart or reload - changes apply instantly.

🚀

Zero Performance Impact

Optimized caching ensures less than 0.5ms overhead. Get compatibility without sacrificing speed.

↗️

Redirect Support

Full support for Redirect and RedirectMatch directives with regex patterns and capture groups for URL rewrites.

📝

FilesMatch Support

Apply headers based on file patterns with regex matching. Perfect for setting cache headers on specific file types.

⏱️

Expires Directives

Complete mod_expires compatibility with ExpiresActive and ExpiresByType. Automatic Cache-Control headers.

🔄

Request Headers

RequestHeader support for setting request headers via environment variables. Perfect for proxy configurations and backend routing.

⚙️

Environment Variables

SetEnv, SetEnvIf, and BrowserMatch directives with conditional logic. Set $_SERVER variables based on request properties.

🐘

PHP Configuration

Breakthrough feature! Full php_value and php_flag support. Configure PHP settings per directory - previously impossible in OpenLiteSpeed.

Supported Directives

Full Apache .htaccess Compatibility + PHP Config

All the directives you need, including the breakthrough PHP configuration

Header Directives ✅ Fully Supported

Complete support for all header manipulation directives including set, unset, append, merge, and add operations. Perfect for security headers, CORS, cache control, and custom headers.

# Security Headers
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set Strict-Transport-Security "max-age=31536000"

# CORS Headers
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"

# Cache Control
Header set Cache-Control "public, max-age=3600"

# Remove Headers
Header unset X-Powered-By

# Append to Existing
Header append Vary "Accept-Encoding"

ErrorDocument ✅ Fully Supported

Custom error page handling for all HTTP status codes. Maintain professional branding even on error pages with fully functional ErrorDocument directives.

# Custom Error Pages
ErrorDocument 404 /errors/404.html
ErrorDocument 403 /errors/forbidden.html
ErrorDocument 500 /errors/500.html
ErrorDocument 503 /errors/maintenance.html

Access Control ✅ Fully Supported

Complete IP-based access control with Order, Allow, and Deny directives. Supports individual IPs and CIDR ranges for flexible network-level security.

# Whitelist Approach - Block all except allowed
Order deny,allow
Deny from all
Allow from 192.168.1.0/24
Allow from 10.0.0.5

# Blacklist Approach - Allow all except denied
Order allow,deny
Allow from all
Deny from 203.0.113.0/24

# Complex Rules
Order deny,allow
Deny from all
Allow from 192.168.0.0/16    # Internal network
Allow from 10.0.0.0/8         # VPN
Allow from 172.16.0.0/12      # Private subnet

Redirect Directives ✅ Fully Supported

Full support for Redirect and RedirectMatch directives with regex patterns and capture groups. Perfect for URL migrations, enforcing trailing slashes, or redirecting old URLs to new locations.

# Simple Redirects
Redirect 301 /old-page /new-page
Redirect permanent /old-url https://new-domain.com/page

# Regex Pattern Matching with RedirectMatch
RedirectMatch 301 ^/blog/(.*)$ /news/$1
RedirectMatch permanent ^/products/(.+)\.html$ /shop/$1

# Enforce trailing slashes
RedirectMatch 301 ^/(.+[^/])$ /$1/

# Category redirects with capture groups
RedirectMatch 301 ^/category/([^/]+)/page/([0-9]+)$ /cat/$1?p=$2

FilesMatch Directives ✅ Fully Supported

Apply headers based on file extension patterns using regex. Ideal for setting cache headers, security headers, or content types for specific file types without modifying application code.

# Cache Control for Images
<FilesMatch "\.(jpg|jpeg|png|gif|webp)$">
    Header set Cache-Control "max-age=31536000"
    Header set X-Content-Type-Options "nosniff"
</FilesMatch>

# Cache for CSS and JavaScript
<FilesMatch "\.(css|js)$">
    Header set Cache-Control "public, max-age=2592000"
</FilesMatch>

# Security headers for HTML files
<FilesMatch "\.html$">
    Header set X-Frame-Options "SAMEORIGIN"
    Header set Content-Security-Policy "default-src 'self'"
</FilesMatch>

# Force download for specific file types
<FilesMatch "\.(pdf|doc|docx)$">
    Header set Content-Disposition "attachment"
</FilesMatch>

Expires Directives (mod_expires) ✅ Fully Supported

Complete Apache mod_expires compatibility with ExpiresActive and ExpiresByType directives. Automatically sets both Expires headers (RFC 2822 format) and Cache-Control: max-age headers for optimal browser caching.

# Enable expires processing
ExpiresActive On

# Images - 1 year cache
ExpiresByType image/jpeg A31557600
ExpiresByType image/png A31557600
ExpiresByType image/gif A31557600
ExpiresByType image/webp A31557600

# CSS and JavaScript - 30 days
ExpiresByType text/css A2592000
ExpiresByType application/javascript A2592000

# HTML - 1 hour
ExpiresByType text/html A3600

# PDFs - 30 days
ExpiresByType application/pdf A2592000

# Base codes: A (access time) or M (modification time)
# Time in seconds: 3600=1h, 86400=1d, 2592000=30d, 31557600=1y

RequestHeader Directives ✅ Fully Supported

Set and unset request headers via environment variables. Headers become accessible to PHP and backend applications as $_SERVER variables. Perfect for proxy configurations, SSL offloading, and backend routing. Note: Implemented via environment variables since LSIAPI doesn't provide direct request header modification.

# SSL/HTTPS Proxy Configuration
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-SSL "on"

# Backend Server Configuration
RequestHeader set X-Backend-Server "main"
RequestHeader set X-Environment "production"

# Custom Application Headers
RequestHeader set X-Custom-Header "value"
RequestHeader set X-Client-Type "web"

# Result in PHP:
# $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'
# $_SERVER['HTTP_X_BACKEND_SERVER'] = 'main'
# etc.

# Remove headers
RequestHeader unset X-Old-Header

Environment Variable Directives ✅ Fully Supported

Set environment variables unconditionally (SetEnv) or conditionally based on request properties (SetEnvIf, SetEnvIfNoCase, BrowserMatch). Variables are accessible as $_SERVER in PHP. Supports conditions on Request_URI, User-Agent, Request_Method, Host, and more.

# Unconditional environment variables
SetEnv APPLICATION_ENV production
SetEnv API_VERSION v2
SetEnv CUSTOM_VAR "some value"

# Conditional based on User-Agent
SetEnvIf User-Agent ".*iPhone.*" mobile_device
SetEnvIfNoCase User-Agent "android" mobile_device
BrowserMatch "MSIE" old_browser

# Conditional based on Request URI
SetEnvIf Request_URI "^/api/" api_request
SetEnvIf Request_URI "\.json$" json_response

# Conditional based on Request Method
SetEnvIf Request_Method "POST" is_post_request

# Conditional based on Host
SetEnvIf Host "^staging\." staging_env

# Multiple conditions
SetEnvIf Request_URI "^/admin/" admin_area
SetEnvIf User-Agent ".*Mobile.*" mobile_device

# In PHP, access as:
# $_SERVER['APPLICATION_ENV']
# isset($_SERVER['mobile_device'])
# etc.

PHP Configuration (php_value/php_flag) ✅ Breakthrough Feature!

Revolutionary feature previously considered impossible in OpenLiteSpeed! Configure PHP settings directly in .htaccess just like Apache. Set memory limits, upload sizes, error handling, timezones, and more on a per-directory basis without editing php.ini or restarting PHP.

# Memory and Upload Limits
php_value memory_limit 768M
php_value upload_max_filesize 150M
php_value post_max_size 150M
php_value max_execution_time 600
php_value max_input_time 600

# Error Handling and Logging
php_flag display_errors On
php_flag log_errors On
php_admin_value error_log /var/log/php-errors.log
php_flag display_startup_errors On

# Security Settings (use php_admin_flag for security-critical)
php_admin_flag allow_url_fopen Off
php_admin_flag allow_url_include Off
php_admin_flag file_uploads On

# Date and Time
php_value date.timezone "America/New_York"
php_value default_charset "UTF-8"

# Session Configuration
php_value session.gc_maxlifetime 7200
php_value session.cookie_lifetime 0
php_flag session.use_strict_mode On

# Output Control
php_flag output_buffering On
php_value output_handler mb_output_handler

# Database Settings
php_value mysqli.default_socket /var/run/mysqld/mysqld.sock
php_value pdo_mysql.default_socket /var/run/mysqld/mysqld.sock

# File Upload Settings
php_value upload_tmp_dir /tmp
php_value max_file_uploads 20

# Performance Tuning
php_value realpath_cache_size 4096K
php_value realpath_cache_ttl 600

# Note: php_admin_value and php_admin_flag prevent 
# runtime override via ini_set() for security
Simple Pricing

One Module, Unlimited Sites

Save more with multi-year plans

1 Year

$59
per year
Unlimited sites
All features included
1 year of updates
Priority support

3 Years

$177
$142
$47/year
Save $35 (20% OFF)
Unlimited sites
All features included
3 years of updates
Priority support
Success Stories

Trusted by Server Administrators

See what our users are saying

"

Migrated 50+ WordPress sites from Apache to OpenLiteSpeed in one afternoon. This module saved us weeks of work rewriting rules.

JD
John Davis
Web Hosting Provider
"

Finally! Our security headers and IP restrictions work without any modifications. This should be built into OpenLiteSpeed.

SK
Sarah Kim
DevOps Engineer
"

Worth every penny. No more explaining to clients why their .htaccess doesn't work after migration. It just works.

MP
Mike Peterson
Freelance Developer
"

The PHP configuration support is a game-changer! I can now set memory limits and upload sizes per directory without touching php.ini. This feature alone is worth the price.

TL
Tom Lopez
Agency Owner
FAQ

Frequently Asked Questions

Everything you need to know

How easy is the installation?
Super easy! We provide a one-command installer that downloads a pre-built binary, configures OpenLiteSpeed, sets up your license, and restarts the server automatically. Just run one command and you're done. Installation details are provided in your welcome email.
How does license validation work?
The module performs automated daily license checks against our platform (platform.cyberpersons.com). It validates your license key, checks expiry, and caches the result for 24 hours to minimize API calls. If validation fails, features are disabled until a valid license is restored.
Does PHP configuration (php_value/php_flag) really work?
Yes! This is our breakthrough feature. You can now use php_value and php_flag directives in .htaccess to configure PHP settings per directory - something previously considered impossible in OpenLiteSpeed. Set memory limits, upload sizes, error handling, timezones, and more without editing php.ini. This works through custom OpenLiteSpeed core extensions that integrate with the LSIAPI.
Which .htaccess directives are supported?
The module supports Header directives (set, unset, append, merge, add), RequestHeader directives (set/unset), PHP Configuration (php_value, php_flag, php_admin_value, php_admin_flag), ErrorDocument for custom error pages, Access Control directives (Order, Allow, Deny) with IP and CIDR range support, Redirect and RedirectMatch with regex patterns, FilesMatch for pattern-based headers, Expires directives (mod_expires compatibility), and environment variable directives (SetEnv, SetEnvIf, SetEnvIfNoCase, BrowserMatch). These cover 98%+ of typical .htaccess use cases.
Do I need to modify my existing .htaccess files?
No! That's the beauty of this module. Your existing Apache .htaccess files work as-is without any modifications. Just install the module and your files start working immediately.
Will this slow down my server?
No. The module uses efficient caching with hash tables and adds less than 0.5ms overhead per request. You get Apache compatibility without sacrificing OpenLiteSpeed's performance advantages.
How does the module handle .htaccess file changes?
The module uses mtime-based cache invalidation to automatically detect changes. When you update an .htaccess file, the changes apply instantly without requiring a server restart or manual cache clearing.
Does it work with all CyberPanel installations?
Yes, the module is fully compatible with all CyberPanel installations running OpenLiteSpeed. It integrates seamlessly with your existing setup without requiring any special configuration.
Can I use this on multiple servers?
Each license covers one server installation but supports unlimited sites on that server. For multiple servers, you'll need additional licenses.
What about updates and support?
Your license includes all updates for the duration of your plan (1, 2, or 3 years) plus priority support. We continuously improve the module and add support for more directives.
How do RequestHeader and SetEnv directives work?
RequestHeader directives set request headers via environment variables, making them accessible as $_SERVER variables in PHP (e.g., X-Forwarded-Proto becomes $_SERVER['HTTP_X_FORWARDED_PROTO']). SetEnv sets variables unconditionally, while SetEnvIf and BrowserMatch set them based on conditions like User-Agent, Request_URI, or Request_Method. These are perfect for proxy configurations, SSL offloading, and backend routing.
How secure is the module?
The module implements multiple security measures including path traversal prevention, input validation for all directives, memory bounds checking, and uses OpenLiteSpeed's reliable client IP detection to prevent spoofing. It's production-ready and thoroughly tested.
Resources

Documentation & Support

Everything you need to succeed

📚

Documentation

Comprehensive guides covering installation, configuration, and troubleshooting for all supported directives.

View Docs →
💬

Community Forum

Join thousands of CyberPanel users discussing best practices, sharing tips, and helping each other.

Join Community →
🔧

GitHub Repository

Access source code, view comprehensive test results, report issues, and see detailed documentation including build guides and API research.

View on GitHub →

Stop Fighting with .htaccess Files

Join hundreds of administrators who've made migration painless.
Now with PHP configuration support - a true game-changer!

🚀 Get Instant Access - $59