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
338
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
4,207
Replies
9
Views
12,093
  • Locked
Replies
9
Views
7,981
Newer threads
Latest threads
Replies
4
Views
246
Replies
2
Views
184
Replies
0
Views
167
Replies
0
Views
147
Recommended threads
Top