Answers for "301 redirect"

3

php 301 redirect

<?php // Permanent 301 Redirect via PHP
	header("HTTP/1.1 301 Moved Permanently");
	header("Location: http://domain.tld/new/location/");
	exit();
?>
Posted by: Guest on September-28-2020
-1

redirect htaccess 301

Redirect 301 /pagename.php http://www.domain.com/pagename.html
Posted by: Guest on June-12-2020
3

301 redirect

301, "Moved Permanently"—recommended for SEO
302, "Found" or "Moved Temporarily"
Meta Refresh
Posted by: Guest on November-10-2020
1

301 redirect http to https

#For apache .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Posted by: Guest on October-02-2020
1

301 redirect

#In .htaccess
  
Redirect 301 /old-page https://www.example.com/new-page
Posted by: Guest on July-13-2020
0

301 redirect

#http to https and www to non-www
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Posted by: Guest on June-23-2020

Browse Popular Code Answers by Language