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
SEO-Friendly Permanent Redirects

How to Redirect Old URLs and Domains with `.htaccess`

For simple static URL transfers, `Redirect`/`RedirectPermanent` can be used, and `mod_rewrite` can be used for conditional or regex cases. The correct 301 target should go to the final canonical URL in one step; path, query string, and exceptions should be managed consciously.

301 RedirectDomain MigrationQuery StringRedirect Chainmod_alias
Apache/LiteSpeed Diagnostics
301 Moved Permanently
Location: https://new.example.com/path
Redirect chain detected
ERR_TOO_MANY_REDIRECTS
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

301 URL and Domain Redirect How to analyze?

For simple static URL transfers, `Redirect`/`RedirectPermanent` can be used, and `mod_rewrite` can be used for conditional or regex cases. The correct 301 target should go to the final canonical URL in one step; path, query string, and exceptions should be managed consciously.

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 redirect all old URLs indiscriminately to the home page.

02
Live problem dictionary

Apache, redirect and access messages

01kritik

Redirect loop

Meaning: The source URL redirects back to itself or to a previous URL.

Possible cause: A broad regex or a bidirectional rule.

02warning

All URLs go to the home page

Meaning: Path is not being preserved.

Possible cause: Using a fixed target.

03warning

The query string was unintentionally carried over

Meaning: Apache may preserve the existing query by default.

Possible cause: QSD was not used.

04warning

Two or three 301 chain

Meaning: The old URL passes through intermediate targets.

Possible cause: HTTP, www, and path rules are separate.

05warning

A regex special character is matching

Meaning: The dot or question mark was not escaped.

Possible cause: Incorrect regular expression.

06warning

The redirect does not work without the old file

Meaning: The rule is in the wrong context or order.

Possible cause: The WordPress front controller runs first.

07warning

302 remained

Meaning: The temporary redirect is creating cache or SEO signal issues.

Possible cause: The R flag has no code or is a panel setting.

08bilgi

Encoded URL does not match

Meaning: Apache decodes path at certain stages.

Possible cause: Turkish characters, spaces in URLs, and regex differences.

No records matching this expression were found.

03
Copiable controls

curl, Apache log and file tests

Redirect zinciri

curl -sIL --max-redirs 15 https://example.com/old-url | grep -iE '^HTTP|^location:'

Lists all redirect hops.

Single code test

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

Shows the final destination and the number of redirects.

Query String Test

curl -sIL 'https://example.com/old-url?utm_source=test&id=42' | grep -iE '^HTTP|^location:'

Shows how parameters are carried to the target.

Redirect rules

grep -nE 'Redirect|RedirectMatch|RewriteRule|RewriteCond' .htaccess

Shows the redirect rules with their order numbers.

Bulk URL test

while read -r src dst; do final=$(curl -sS -o /dev/null -w '%{url_effective}|%{http_code}|%{num_redirects}' -L "$src"); echo "$src|$dst|$final"; done < redirects.txt

Kaynak-hedef listesini toplu test eder.

Canonical control

curl -sL https://new.example.com/new-url | grep -ioE '<link[^>]+rel=["'"']canonical["'"'][^>]*>' | head -n 1

Shows the target page's canonical tag.

04
Correct and incorrect structure

.htaccess rule comparisons

Tek sabit URL

Risky / Incorrect
RewriteRule old-page new-page [R=301,L]
Right Approach
Redirect 301 /old-page https://example.com/new-page

Path-preserving domain migration

Risky / Incorrect
RewriteRule ^ https://new.example.com/ [R=301,L]
Right Approach
RewriteCond %{HTTP_HOST} ^(?:www\.)?old\.example\.com$ [NC]
RewriteRule ^ https://new.example.com%{REQUEST_URI} [R=301,L]

Query string silme

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

Anchor usage

Risky / Incorrect
RewriteRule product /new-product [R=301,L]
Right Approach
RewriteRule ^product/?$ /new-product [R=301,L]
05
Application by infrastructure

Apache, cPanel, Plesk, LiteSpeed and applications

Apache mod_alias

For fixed-path redirects, it may be simpler and more readable.

  • Use an absolute target for Redirect 301.
  • Do not use RewriteRule if regex is not needed.
  • Check the Redirect directive order.

Apache / LiteSpeed mod_rewrite

Used for host, query, path, and conditional migrations.

  • Place the rule before the WordPress/WISECP front controller.
  • Use a temporary code during the testing process.
  • Provide the final destination in a single hop.

cPanel / Plesk / SEO Migration

Panel redirects can generate `.htaccess` or vhost config entries.

  • Do not create duplicate rules in both the panel and the file.
  • Update the sitemap and internal links to the new URL.
  • Also manage the Search Console domain change processes.
Incorrect interventions

Absolutely don't

  • Do not redirect all old URLs indiscriminately to the home page.
  • Do not use broad regex for thousands of URLs without testing.
  • Do not accidentally let a temporary test rule be cached as a permanent 301.
  • Do not try to resolve redirect chains with canonical tags.
Post-procedure check

Verify the solution

  • Each old URL redirects to the relevant new URL in a single hop.
  • The query string behavior is as planned.
  • Target pages return 200 and the correct canonical.
  • The sitemap and internal links no longer use the old URL.
06
Internal SEO content set

Related .htaccess solutions

07
primary sources

Apache, WordPress and panel documentation

08
Frequently asked questions

301 URL and Domain Redirect Curiosities about

Does the 301 URL and Domain Redirect 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