Redirect
- Redirect a page to another using HTML
- HTTP 301 Redirect using PHP
- Redirect a site to HTTPS using PHP
- Redirect a site to www using PHP
- Redirect HTTP to HTTPS when using Reverse Proxy
- Redirect site from www to non-www
- Redirect site to HTTPS excluding a folder
- Redirect a folder to another
- Fix Canonical URL using .htaccess
- WordPress Redirect Visitor On 404 Error
Nginx
- Nginx Redirect
- Nginx remove html from url
- How to redirect a domain with html extension in Nginx
- Nginx Redirect HTTP to HTTPS
IIS
Redirect a site to HTTPS using .htaccess file
1 2 3 |
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] |
Redirect a web site to SSL using Apache Virtual Host
1 2 3 4 |
<VirtualHost *:80> ServerName www.yourdomain.com Redirect permanent / https://www.yourdomain.com/ </VirtualHost> |
OR
1 2 3 4 |
RewriteEngine on RewriteCond %{SERVER_NAME} =yourdomain.com [OR] RewriteCond %{SERVER_NAME} =www.yourdomain.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] |
Redirect a Site to HTTPS using PHP
1 2 3 4 |
if ($_SERVER["HTTPS"] != "on") { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://www.yourdomain.com"); } |
Redirect www to non-www URL
1 2 3 |
RewriteEngine On RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC] RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301] |