Hello,
I've got the following redirects in my .htaccess:
# Enable the rewrite engine
RewriteEngine On
# Custom 404 error handling
ErrorDocument 404 /404-handler.php
# Redirect 404 errors containing 'artigos' or 'blog' to URL1
RewriteCond %{REQUEST_URI} artigos [NC,OR]
RewriteCond %{REQUEST_URI} /item/ [NC,OR]
RewriteCond %{REQUEST_URI} /blog [NC]
RewriteRule .* https://www.portal-gestao.com/posts.html [R=301,L]
And the following PHP handler:
<?php
// Set the response code to 404
http_response_code(404);
// Check the request URI for specific keywords
if (preg_match('/artigos|\/item\/|\/blog/i', $_SERVER['REQUEST_URI'])) {
header("Location: https://www.portal-gestao.com/posts.html");
exit;
} elseif (preg_match('/comprar-curso/i', $_SERVER['REQUEST_URI'])) {
header("Location: https://www.portal-gestao.com/cursos-online.html");
exit;
}
// Display a 404 error page or handle as needed
echo "404 Not Found";
?>
Although I've disabled these redirects and this handler file, the images within the posts, like:
https://www.portal-gestao.com/images/ar ... mate_2.png
Are redirecting to:
https://www.portal-gestao.com/posts.html
There are no other redirects in .htaccess and I can't figure out why on earth is this redirecting happening.
Can anyone help?
I've got the following redirects in my .htaccess:
# Enable the rewrite engine
RewriteEngine On
# Custom 404 error handling
ErrorDocument 404 /404-handler.php
# Redirect 404 errors containing 'artigos' or 'blog' to URL1
RewriteCond %{REQUEST_URI} artigos [NC,OR]
RewriteCond %{REQUEST_URI} /item/ [NC,OR]
RewriteCond %{REQUEST_URI} /blog [NC]
RewriteRule .* https://www.portal-gestao.com/posts.html [R=301,L]
And the following PHP handler:
<?php
// Set the response code to 404
http_response_code(404);
// Check the request URI for specific keywords
if (preg_match('/artigos|\/item\/|\/blog/i', $_SERVER['REQUEST_URI'])) {
header("Location: https://www.portal-gestao.com/posts.html");
exit;
} elseif (preg_match('/comprar-curso/i', $_SERVER['REQUEST_URI'])) {
header("Location: https://www.portal-gestao.com/cursos-online.html");
exit;
}
// Display a 404 error page or handle as needed
echo "404 Not Found";
?>
Although I've disabled these redirects and this handler file, the images within the posts, like:
https://www.portal-gestao.com/images/ar ... mate_2.png
Are redirecting to:
https://www.portal-gestao.com/posts.html
There are no other redirects in .htaccess and I can't figure out why on earth is this redirecting happening.
Can anyone help?
Statistics: Posted by tigger — Thu Jul 04, 2024 3:19 pm