Redirect 404 Errors

hambryseo

New Member
Forgive me if this has been answered before, I have searched but could not find the answer.

I have installed Visio List on a domain which previously used a different script. I have several inbound links that were created to use the old script, that now return 404 errors.

For SEO reasons, I would like to preserve those links by doing a permanent 301 redirect of any 404 pages to the homepage.

Normally I would add the code below to .htaccess, however due to the existing .htaccess entires this does not work with Visio List. You get a too many redirects error.

So my question is, how can I achieve this with Visio List?

# Code I would normally add to .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ / [R=301,L]
 

Mark

Administrator
Staff member
hello, I think these 2 lines are conflicting:

RewriteRule ^(.*)$ %{REQUEST_URI}/ [R=301,L]


RewriteRule ^(.*)$ / [R=301,L]

Can you try removing the first one and see how that works?
 

hambryseo

New Member
Hi Mark

Thanks for your reply. Doing that does get rid of the too many redirects error, but doesn't fix the problem.

The inbound links are in the format: www.site.com/in.php?site=xxx

Even with the second line in place, the above still returns 404.
 

Mark

Administrator
Staff member
ahh thanks for that URL, this explains it. you should not need to redirect those with such a generic rule, the problem is that old URL is very similar to what aardvark used 15+ years ago :)

if you converted an old list and have the same members, you can do this instead of messing with .htaccess redirects

open in.php

find:
header("Location: index.php?a=in&u=".$_GET['id']);

replace with:

header("Location: index.php?a=in&u=".$_GET['site']);

if you have kept the same usernames/siteID's this will also allow those old votes to count.

if you deleted those users or changed their usernames, simply change in.php to this:

header("HTTP/1.1 301 Moved Permanently");
header("Location: ./");
 

hambryseo

New Member
Thanks again for your reply. I found an in.php file but it's in the "sources" folder. Do I edit it there or do I need to move it to the root directory in order to get those inbound links to work.

I would love to make the links still work in terms of counting the votes. However this is a new installation. Is there any way I can edit the new users to make sure they have the same IDs as the old ones? Would I need to go into the database to do this?

Thanks again for your help.
 

hambryseo

New Member
PS I think you're right, the original installation used Aardvark which is why I picked Visio to replace it. Shame I don't have access to the old files / database though.
 

Mark

Administrator
Staff member
since its a new installation and you don't have the old database to import from, your only option is really to create in.php in your root directory (the same folder as the one that holds settings_sql.php)

with the following contents:

PHP:
header("HTTP/1.1 301 Moved Permanently");
header("Location: ./");
 

hambryseo

New Member
Thanks, that seems to have worked.

Shame I can't preserve the vote counting, but not to worry, this is still a workable solution.

Thanks for your help.
 
Top