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
3,836
Replies
9
Views
10,306
  • Locked
Replies
9
Views
7,413
Newer threads
Latest threads
Replies
2
Views
112
Replies
1
Views
187
Replies
6
Views
418
Replies
11
Views
544
Replies
2
Views
238

Latest postsNew threads

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