Glossary

What Is .htaccess?

An .htaccess file is a configuration file used by Apache web servers to control server behavior on a per-directory basis. It's commonly used for URL redirects, access control, and URL rewriting — without modifying the main server configuration.

Why It Matters

.htaccess is one of the most common ways to set up redirects on traditional web hosting. It’s powerful but requires Apache hosting and technical knowledge. Understanding .htaccess helps when migrating from self-managed redirects to a dedicated service.

Common .htaccess Redirect Rules

Simple domain redirect

RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain\.com [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]

Force HTTPS

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Redirect single page

Redirect 301 /old-page https://example.com/new-page

.htaccess vs Domain Forward

For a detailed comparison, see our .htaccess vs Domain Forward page.

Feature.htaccessDomain Forward
Requires hostingYes (Apache)No
HTTPS supportRequires separate SSL certificate setupAutomatic
ConfigurationRegex syntax in text filesDashboard
Path forwardingYes (RewriteRule)Yes (built-in)
Wildcard redirectsYes (RewriteCond)Yes (built-in)
MaintenanceYou manage serverManaged
PerformanceDepends on hosting<5ms latency

When to Use .htaccess vs Domain Forward

  • Use .htaccess when you already have Apache hosting and need complex URL rewriting alongside an active website
  • Use Domain Forward when you need simple domain forwarding without maintaining a server, or when your domain isn’t hosted anywhere

Related Terms

Related Features

Frequently
asked questions

It works but requires Apache hosting, server access, and technical knowledge. For domain-only forwarding, a service like Domain Forward is simpler — no server needed.

Still Confused? Try It Free.

Set up your first domain forward in under 5 minutes. Free plan includes 5 domains.