Transfer vB 4.2 to Xenforo (new domain)

Jake Bunce

XenForo moderator
Staff member
#21
@Ranma1981

Add these rules to the top of the .htaccess file in the web root of forum.mysite.it:

Rich (BB code):
RewriteEngine On

RewriteRule ^(msn-messenger|other-category|yet-another-category)/([0-9]+)-[^\./]\.html$ /threads/$2/ [R=301,L]
That should do it. You must explicitly list all category names using the format demonstrated in red (use pipes to separate the names).
 
#22
Hello Jake,

please, now I am with Nginx, I converted your rule (I hope that it's correct) to:

Code:
rewrite ^/(msn-messenger|other-category|yet-another-category)/([0-9]+)-[^./].html$ /threads/$2/ permanent;
But it doesn't work; according you, is there any error?

Thank you :)
 

Jake Bunce

XenForo moderator
Staff member
#23
Hello Jake,

please, now I am with Nginx, I converted your rule (I hope that it's correct) to:

Code:
rewrite ^/(msn-messenger|other-category|yet-another-category)/([0-9]+)-[^./].html$ /threads/$2/ permanent;
But it doesn't work; according you, is there any error?

Thank you :)
You lost the backslashes on the periods.
 
#24
Hello Jake,

you have right, I corrected the code to:

Code:
rewrite ^/(msn-messenger|other-category|yet-another-category)/([0-9]+)-[^\./]\.html$ /threads/$2/ permanent;
I think that now is correct, right? Howeaver, I tried it live but doesn't seem works well.

Than, I made an error and I leaved forum online with debug enabled, now I noted some strange url always from Webmaster Tool, like this:

Code:
http://forum.tech-magazine.it/members/gingolino.126/recent-activity?_debug=1
Code:
http://forum.tech-magazine.it/threads/il-manager-degli-u2-gli-isp-paghino-la-musica.39326/?_debug=1&_debug=1
Please, could you suggest me other rewrite rules to redirect these urls to original url?

Thank you very much for your help :)
 
#25
Hello Jake, sorry for double post.

Do you have a solution to correct this errors? Webmaster Tool continue to advice me regard that mistaked, I need to correct they and improve the indexing.

Thank you ;)
 
#27
Hello Jake,

thank you for reply; please I have two questions for you.

1) I tried that code for debug problem url and it works well. According your experience, do you think that the best solution to correct those false url's is return HTTP 410? Therefore, I have 800 url's about with this problem and I thought that for Google, was better redirect false url's to the original url.

2) I corrected the rewrite url to use with Nginx, who you adviced me but it doesn't work well.

Code:
rewrite ^/(msn-messenger|other-category|yet-another-category)/([0-9]+)-[^\./]\.html$ /threads/$2/ permanent;
Do you have idea why it doesn't redirect the url's?

Thank you very much Jake
 

Jake Bunce

XenForo moderator
Staff member
#28
1) If you want to redirect...

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} _debug=1
RewriteRule ^(.*)$ /$1? [R=301,L]
That will strip the query string from debug URLs and redirect them.

2) For nginx try this:

Code:
        location ~* ^/(msn-messenger|other-category|yet-another-category)/[0-9]+-[^\./]\.html$ {
                rewrite ([0-9]+)-[^\./]\.html
/threads/$1/ last;
        }
I am less comfortable with nginx configs, but I think this will work.
 
Top