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

Michele D.

Member
Registered
Joined
Jul 16, 2014
Messages
45
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

Well-known member
Registered
Joined
Jul 10, 2012
Messages
141
Points
0
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,078
Replies
9
Views
5,371
  • Locked
Replies
9
Views
5,356
Replies
5
Views
3,130
Newer Threads
Replies
16
Views
7,908
Replies
3
Views
3,640
Recommended Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

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