Website Redirection¶
Redirect visitors from one address to another using HTML.
-
Domain Change
Redirect from old domain to new one.
-
Content Move
Page moved to new URL.
-
Maintenance
Temporary redirect during maintenance.
-
Simple
No server configuration required.
When to Use Redirection?¶
- Domain Change
-
old-domain.sk→new-domain.sk - Content Move
-
/article.html→/new/article-2025.html - Site Maintenance
-
Temporary redirect during deployment of new version.
Redirection Types¶
| Method | Use Case | SEO Impact |
|---|---|---|
| HTML meta refresh | Simple, quick | Weaker |
| .htaccess 301 | Permanent redirect | Best |
| PHP header | Dynamic redirect | Good |
Recommendation
For permanent redirects, use .htaccess 301. HTML redirection is suitable for quick and temporary solutions.
HTML Redirection¶
Immediate Redirect¶
Create or edit index.html file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=https://www.new-site.sk">
<title>Redirect</title>
</head>
<body>
<p>If you are not automatically redirected,
<a href="https://www.new-site.sk">click here</a>.</p>
</body>
</html>
Explanation
content="0; url=..." – redirects immediately (0 seconds).
Delayed Redirect¶
Show message before redirecting:
This redirects after 5 seconds – suitable for:
- Maintenance notice
- Information about page relocation
- New version notification
.htaccess Redirection (301)¶
For permanent redirects, create .htaccess file:
# Redirect entire domain
Redirect 301 / https://www.new-domain.sk/
# Redirect specific page
Redirect 301 /old-page.html https://www.new-domain.sk/new-page.html
SEO
301 redirect is best for SEO – preserves page ranking.
Method Comparison¶
| HTML refresh | .htaccess 301 | |
|---|---|---|
| Implementation | Very simple | Requires .htaccess access |
| SEO | Weaker | Best |
| Server settings | Not needed | Required |
| Type | Temporary | Permanent |
Common Mistakes¶
Infinite loop
Page redirects to itself.
Solution: Check URL in redirect – must be different from current.
Redirect doesn't work
Browser caches old version of page.
Solution: Clear browser cache or use Ctrl+F5.
SEO issues
HTML redirection is not ideal for search engines.
Solution: For permanent redirects, use .htaccess 301.