• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Redirect 404 to Homepage

#1
Ahoy there!

I have 240 404 errors, most of them are from wordpress based site I wanted to develop, after that I found this awesome software called xenForo, I tried demo and was love at first sight :D

So now I want to redirect them to homepage? Should be okay? How can I do it via .htaccess?

I need your help, thanks in advance.
 

tommydamic68

Well-known member
#3
Ahoy there!

I have 240 404 errors, most of them are from wordpress based site I wanted to develop, after that I found this awesome software called xenForo, I tried demo and was love at first sight :D

So now I want to redirect them to homepage? Should be okay? How can I do it via .htaccess?

I need your help, thanks in advance.
I like to use a custom 404 error page to do the redirecting to my site. Its good SEO (as long as it is not large numbers of error pages redirecting to a 404) as well as the end users experience.:)

Mine. Its slightly animated as well.
Screen Shot 2014-05-01 at 8.38.41 PM.png
 
#4
ErrorDocument 404 http://YOURSITE

Put that in your htaccess file
Is not working or I'm doing something wrong. My forum is http://ypayz.com/

This is .htaccess
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
I don't want custom 404. I want redirect to homepage, but how?
 

MattW

Well-known member
#5
Is not working or I'm doing something wrong. My forum is http://ypayz.com/

This is .htaccess
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
I don't want custom 404. I want redirect to homepage, but how?
This works for me on a test site:
Code:
ErrorDocument 404 http://old.britishmods.com/index.php
 

ibrian

Well-known member
#6
Code:
ErrorDocument 404 http://old.britishmods.com/index.php
I'm afraid this doesn't work for me, either.

Surely there's a simple solution for redirecting a 404 to the forum homepage, instead of the default error page? Just that it does nothing to encourage visitors to interact with a website.
 

dethfire

Well-known member
#7
What's Google's say on this. I don't think they'd like it. If a page doesn't exist they want to know it and for users to know it.
 

tommydamic68

Well-known member
#8
Code:
ErrorDocument 404 http://old.britishmods.com/index.php
I'm afraid this doesn't work for me, either.

Surely there's a simple solution for redirecting a 404 to the forum homepage, instead of the default error page? Just that it does nothing to encourage visitors to interact with a website.
For SEO purposes, it's best to have a working 404 page, it's not recommended to have an error page redirect to your forum.
https://xenforo.com/community/threads/redirect-404-to-homepage.73341/#post-759887