• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Redirect all 404 to Homepage.

LouisMaitreau

Chevereto Member
Hi Chevereto team,

Is there a ways to redirect all 404 errors to homepage ?

I want to do it beacause I bought an expired domain that had a lot of backlinks and I need to redirect every links to home page.

I already tried some code in the htacess but when I test a wrong URL, I'm not redirected to home page.

Thanks for your help.

Regards,
 
Hi Rodolfo, Thanks for your help,

There's a lot of comment but here's my htaccess file :

Apache config:
# Disable server signature
ServerSignature Off

# Enable CORS across all your subdomains (replace dev\.local with your domain\.com)
# SetEnvIf Origin ^(https?://.+\.dev\.local(?::\d{1,5})?)$   CORS_ALLOW_ORIGIN=$1
# Header append Access-Control-Allow-Origin  %{CORS_ALLOW_ORIGIN}e   env=CORS_ALLOW_ORIGIN
# Header merge  Vary "Origin"

# Disable directory listing (-indexes), Multiviews (-MultiViews)
Options -Indexes
Options -MultiViews

<IfModule mod_rewrite.c>

    RewriteEngine On

RewriteCond %{REQUEST_URI} ^/404/$ [OR]
RewriteCond %{REQUEST_URI} ^/500/$
RewriteRule ^(.*)$ https://www.heberger-image.fr [L]

    # If you have problems with the rewrite rules remove the "#" from the following RewriteBase line
    # You will also have to change the path to reflect the path to your Chevereto installation
    # If you are using alias is most likely that you will need this.
    #RewriteBase /

    # 404 images
    # If you want to have your own fancy "image not found" image remove the "#" from RewriteCond and RewriteRule lines
    # Make sure to apply the correct paths to reflect your current installation
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteRule images/.+\.(gif|jpe?g|png|bmp|webp) - [NC,L,R=404]
    #RewriteRule images/.+\.(gif|jpe?g|png|bmp|webp) content/images/system/default/404.gif [NC,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !\.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpe?g|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
    RewriteRule . index.php [L]

</IfModule>

Here's what I have with a 404 error :
Capture.JPG
(sorry, it's french but it means that it doesn't exist) And I would like it to be redirected to the home page.

My hoster is a french one with a Cpanel --> https://www.o2switch.fr/

Thanks again for your help,
 
Last edited:
You need to redirect when a HTTP 404 is thrown, your htaccess redirects paths at /404, not when the HTTP status is being thrown.

If the 404 is generated by Chevereto then the easiest thing to do is to place the redirection in the 404.php template.
 
Hi rodolfo,

I see what you mean so a code like that should work :

Apache config:
ErrorDocument 404 https://www.heberger-image.fr

But infortunatly, It still doesn't help.

Do you have an idea to help me please ?

Thanks a lot 🙂
 
Hi Rodolfo,

Thanks, I've done it.

Here's the process :

I just added a php redirection in the 404.php file, juste after the first php tag :

Code:
<?php
  header('Location: https://www.heberger-image.fr');
  exit();
?>

No need to use the htaccess file. It looks to work well like that.

I prefered a php redirection to a meta refresh or JS redirection.

Thanks again 🙂
 
Last edited:
Back
Top