How to 301 Redirect All old URLs to my main domain in Wordpress?

Michele D.

New member
Joined
Jul 16, 2014
Messages
77
Points
0
Hello webmasters,

I have a question, I have a forum like this forum, using vbulletin platform

but I have just change to wordpress cms instead of using vbulletin as before.

my problem is all URLs indexed by google like

Code:
http://www.domain.com/forums/95-my-forum-name
http://www.domain.com/threads/6236-my-thread-name
..........................
and 
http://www.domain.com/forum.php
Thus, all these old URls got 404 when I changed forum to wordpress blog.

how to How to 301 Redirect All old URLs to my main domain in Wordpress?

I prefer it looks like

Code:
http://www.domain.com/forums/95-my-forum-name  ->  http://www.domain.com
http://www.domain.com/threads/6236-my-thread-name ->  http://www.domain.com
..........................
and 
http://www.domain.com/forum.php ->  http://www.domain.com/forum/
Any helps?

Thanks in advanced!
 

Jovani

Active member
Joined
Jul 10, 2012
Messages
335
Points
28
Code:
http://www.domain.com/forums/95-my-forum-name  ->  http://www.domain.com
http://www.domain.com/threads/6236-my-thread-name ->  http://www.domain.com
..........................
and 
http://www.domain.com/forum.php ->  http://www.domain.com/forum/
Hi Michele, to redirect all old urls to your main domain, you can use this code in your .htaccess file at Worpdress root directory.

Code:
RewriteRule ^forums\/(.+) http://www.domain.com [R=301,L]
RewriteRule ^threads\/(.+) http://www.domain.com [R=301,L]
RewriteRule ^forum.php http://www.domain.com/forum/ [R=301,L]
Complete codes for your htaccess file

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^forums\/(.+) http://www.domain.com [R=301,L]
RewriteRule ^threads\/(.+) http://www.domain.com [R=301,L]
RewriteRule ^forum.php http://www.domain.com/forum/ [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Remember to change domain.com to your domain.

Hope this helps! :pioneer:
 
Older threads
Replies
0
Views
3,454
Replies
9
Views
6,683
  • Locked
Replies
9
Views
6,882
Newer threads
Latest threads
Replies
1
Views
25
Replies
4
Views
29
Replies
2
Views
22
Replies
2
Views
33

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top