Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
AllowOverride and mod_rewrite

Why is .htaccess and RewriteRule not working?

If the file has no effect, the problem is usually whether the `.htaccess` file is being read before the rule itself is checked. `AllowOverride None`, disabled `mod_rewrite`, wrong document root, an `.htaccess.txt` extension, a subdirectory context, or an NGINX-only setup can completely disable all rules.

AllowOverridemod_rewriteRewriteEngineDocument RootNGINX
Apache/LiteSpeed Diagnostics
.htaccess ignored
RewriteRule not working
AllowOverride None
Module rewrite already enabled
404 Not Found
01Verify file and document root
02Take a backup and read the error log
03Separate server and application context
04Verify live result with curl
01
Safe technical approach

.htaccess Not Working How to analyze?

If the file has no effect, the problem is usually whether the `.htaccess` file is being read before the rule itself is checked. `AllowOverride None`, disabled `mod_rewrite`, wrong document root, an `.htaccess.txt` extension, a subdirectory context, or an NGINX-only setup can completely disable all rules.

01

Determine server type

Do not expect a `.htaccess` result without reserving the Apache, LiteSpeed, Plesk proxy or NGINX-only structure.

02

Get backup and logs

Back up the current file with the date; Find the directive and line in the Apache/LiteSpeed error log.

03

Change one rule

Do not change redirect, rewrite, header and access rules all at the same time.

04

Test from outside

Measure the status, Location, Content-Type and redirect number with curl and check the cache layers separately.

Do not intentionally create a syntax error on a live site to prove the file is being read.

02
Live problem dictionary

Apache, redirect and access messages

01kritik

.htaccess is completely ignored

Meaning: None of the directives in the file are being applied.

Possible cause: AllowOverride None or NGINX-only structure.

02kritik

RewriteRule is not working

Meaning: The file is being read but the rewrite does not match.

Possible cause: Wrong regex, leading slash, or rule order.

03warning

mod_rewrite is disabled

Meaning: The RewriteEngine directive cannot be used.

Possible cause: Apache module not loaded.

04warning

.htaccess.txt Has Been Created

Meaning: The file was not saved with the actual `.htaccess` name.

Possible cause: Windows hides extensions.

05warning

Wrong document root

Meaning: The file is in a directory that does not serve requests.

Possible cause: Difference between addon domain, subdomain, or Plesk root.

06warning

Leading slash in subfolder

Meaning: The per-directory RewriteRule pattern does not match.

Possible cause: The pattern starts with `^/product`.

07warning

The real file condition is blocking the rule

Meaning: The existing file/directory exception is skipping the rewrite.

Possible cause: The `-f` or `-d` condition.

08bilgi

No change after Apache restart

Meaning: `.htaccess` is read per request; a restart is not the main issue.

Possible cause: The file is not being read or a cache layer exists.

No records matching this expression were found.

03
Copiable controls

curl, Apache log and file tests

Loaded Apache modules

apachectl -M 2>/dev/null | grep -E 'rewrite|headers|expires|auth_basic'

Lists the required Apache modules.

VirtualHost and document root

apachectl -S

Shows whether the domains match their VirtualHost and document root.

AllowOverride search

grep -RniE 'AllowOverride|AllowOverrideList' /etc/apache2 /etc/httpd /usr/local/apache/conf 2>/dev/null | head -n 100

Finds override permissions in Apache configurations.

Verify the filename

find . -maxdepth 3 -type f -iname '*htaccess*' -printf '%p\n' 2>/dev/null || find . -maxdepth 3 -type f -iname '*htaccess*' -print

Lists incorrectly named htaccess files or those in subdirectories.

Rewrite result

curl -sS -o /dev/null -w 'HTTP:%{http_code} Redirects:%{num_redirects} Final:%{url_effective}\n' -L https://example.com/test-url

Tests the rewrite/redirect result externally.

Server header information

curl -sSI https://example.com | grep -iE '^server:|^via:|^x-powered-by:|^cf-ray:'

Shows Apache, LiteSpeed, NGINX, or proxy signs.

04
Correct and incorrect structure

.htaccess rule comparisons

Leading slash

Risky / Incorrect
RewriteRule ^/product/(.*)$ index.php?slug=$1 [L,QSA]
Right Approach
RewriteRule ^product/(.*)$ index.php?slug=$1 [L,QSA]

RewriteEngine eksik

Risky / Incorrect
RewriteRule ^eski$ /yeni [R=301,L]
Right Approach
RewriteEngine On
RewriteRule ^eski$ /yeni [R=301,L]

Front controller exception

Risky / Incorrect
RewriteRule ^ index.php [L]
Right Approach
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

NGINX-only beklentisi

Risky / Incorrect
RewriteEngine On
RewriteRule ^product/(.*)$ index.php?slug=$1 [L,QSA]
Right Approach
location / {
    try_files $uri $uri/ /index.php?$query_string;
}
05
Application by infrastructure

Apache, cPanel, Plesk, LiteSpeed and applications

Ubuntu / Debian

In the site VirtualHost, `AllowOverride FileInfo` or the required classes must be enabled for the document root.

  • Check the `a2enmod rewrite` status.
  • Match the Directory path in the site config with the actual root.
  • Perform a controlled reload after the config test

cPanel / LiteSpeed

cPanel generally supports `.htaccess` by default; addon domain root and cache layers are common sources of errors.

  • Verify the document root from the Domains screen.
  • Purge both the LiteSpeed Cache and CDN.
  • Investigate the inheritance of rules in the main and subdirectory.

Plesk / NGINX / WISECP

In Plesk, Apache proxy mode and NGINX-only mode behave differently.

  • Verify file types processed by Apache.
  • Place the correct file in the WISECP theme/route root.
  • If NGINX-only, convert the rules to NGINX syntax.
Incorrect interventions

Absolutely don't

  • Do not intentionally create a syntax error on a live site to prove the file is being read.
  • Do not open AllowOverride All value to every directory without considering security requirements.
  • Do not remove all real file/directory exceptions just because a rule is not working.
  • Do not mix Apache and NGINX syntax in the same file.
Post-procedure check

Verify the solution

  • The correct `.htaccess` file is inside the active document root.
  • mod_rewrite is loaded and the required AllowOverride class is enabled.
  • The RewriteRule pattern matches correctly in the per-directory context.
  • Test URL gives the expected result after cache clearing.
06
Internal SEO content set

Related .htaccess solutions

07
primary sources

Apache, WordPress and panel documentation

08
Frequently asked questions

.htaccess Not Working Curiosities about

.htaccess Not Working: Does the Rule Work in NGINX?

No. NGINX does not read `.htaccess` files. The rule must be translated to a `server` or `location` configuration.

Is Apache restart required for .htaccess changes?

Usually not; Apache evaluates the `.htaccess` file on each request. However, a reload or restart is required for VirtualHost, module, or AllowOverride changes.

What should be done before editing the file?

A dated backup of the existing file should be taken, the active document root verified, and the change tested on staging or during low-traffic periods.

Where is the file located in Plesk with cPanel?

In cPanel it is usually inside `public_html`, in Plesk inside `httpdocs`; addon domains and subdomains may have a different document root.

Does LiteSpeed support `.htaccess` rules?

LiteSpeed supports most rules through Apache compatibility; some module and handler behaviors may differ.

Where should I look first in case of a 500 error?

Full directive and line record in Apache/LiteSpeed error log. The file should be restored according to the log instead of being deleted randomly.

Can these codes be added directly to the live site?

Domain should not be added directly without verifying domain, document root, proxy, WordPress, and server structure. Examples should be adapted and tested.

EKA SOFTWARE AND INFORMATION SYSTEMS

Let's edit .htaccess and Apache rules without making the site inaccessible

We examine redirection, rewrite, CORS, access and 500 errors with logs in cPanel, Plesk, LiteSpeed, WordPress, custom PHP and WISECP structures.

Get Server SupportWhatsApp
Top