Last active
June 26, 2017 06:37
-
-
Save yoander/1c15eea63875c667b085267ec9720ea7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check if a redirect is needed | |
$redirect = !isset($_SERVER['HTTPS']) || ('on' != $_SERVER['HTTPS']); | |
$redirect = $redirect || !isset($_SERVER['HTTP_X_FORWARDED_PROTO']) || ('https' != $_SERVER['HTTP_X_FORWARDED_PROTO']); | |
// Permanent redirect to https version | |
if ($redirect) { | |
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], true, 301); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE tableprefix_posts | |
SET | |
post_content = REPLACE(post_content, 'http://www.midominio.com', 'https://www.midominio.com'), | |
post_excerpt = REPLACE(post_content, 'http://www.midominio.com', 'https://www.midominio.com') | |
WHERE post_content LIKE '%http://www.midominio.com%' OR post_excerpt LIKE '%http://www.midominio.com%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment