Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2006, 10:52 AM
tommyxv tommyxv is offline
 
Join Date: Feb 2005
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to setup a 301 redirect correctly

Please chime in of you can help. I changed my directory structure the other day. My forums use to be located at www.mysite.com/vbforums

I move it to www.mysite.com/forums

How and where do I setup a redirect for all the old links?

Thanks,
Reply With Quote
  #2  
Old 05-05-2006, 10:58 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make this your htaccess file in the vbforums root directory.

Quote:
Options +Indexes +FollowSymlinks
RewriteEngine on
RewriteBase /
#
RewriteRule index.html www.mysite.com/forums/$1 [R=301,L,NC]
#
Reply With Quote
  #3  
Old 05-06-2006, 12:36 AM
tommyxv tommyxv is offline
 
Join Date: Feb 2005
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it but it did not work.
Reply With Quote
  #4  
Old 05-06-2006, 02:42 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

put this code in your root .htaccess file

Code:
RewriteRule ^vbforums.* http://www.mysite.com/forums [NC,L,R]
Regards,
Reply With Quote
  #5  
Old 05-06-2006, 03:22 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SaN-DeeP
put this code in your root .htaccess file

Code:
RewriteRule ^vbforums.* http://www.mysite.com/forums [NC,L,R]
Regards,
Ahhh, the man who taught me about this stuff. How come the code I posted didn't work? It was what you gave me for mine and it works for me.
Reply With Quote
  #6  
Old 05-06-2006, 12:05 PM
tommyxv tommyxv is offline
 
Join Date: Feb 2005
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SaN-DeeP
put this code in your root .htaccess file

Code:
RewriteRule ^vbforums.* http://www.mysite.com/forums [NC,L,R]
Regards,
Ok, it is sort of working now.

My old links look like this:
http://www.mysite.com/vbforums/showthread.php?t=19549

The redirect urls look like this and doesn't show the correct page:
http://www.mysite.com/forums/?t=19549


Here is a little twist too. My forums are setup on a sub-domain: http://forums.mysite.com which points to http://www.mysite.com/forums

It will work either way but I would like to have the redirect urls look like my current forum urls:
http://forums.mysite.com/showthread.php?t=19549

My htacces currently looks like this

Code:
Options +Indexes +FollowSymlinks
RewriteEngine on
RewriteRule ^vbforums.* http://www.mysite.com/forums [NC,L,R]
I also tried this to get the urls on the sub-domain but it still cuts off the "showthread.php" part

Code:
Options +Indexes +FollowSymlinks
RewriteEngine on
RewriteRule ^vbforums.* http://forums.mysite.com [NC,L,R]
And I did remember to replace "mysite" with my info. LOL

Thanks in advance Boofo & SaN-DeeP.
Reply With Quote
  #7  
Old 05-08-2006, 11:17 PM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is your problem fixed ?
Reply With Quote
  #8  
Old 05-09-2006, 01:02 PM
tommyxv tommyxv is offline
 
Join Date: Feb 2005
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SaN-DeeP
is your problem fixed ?
No

My old links look like this:
http://www.mysite.com/vbforums/showthread.php?t=19549

The redirect urls look like this and doesn't show the correct page:
http://www.mysite.com/forums/?t=19549
Reply With Quote
  #9  
Old 05-09-2006, 01:20 PM
treasureman treasureman is offline
 
Join Date: Feb 2006
Location: Florida
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:

RewriteRule ^vbforums/(.*)$ forums/$1 [L,R=301]
Reply With Quote
  #10  
Old 05-11-2006, 04:13 AM
tommyxv tommyxv is offline
 
Join Date: Feb 2005
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeap that did. Thanks everyone. :banana:
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:22 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05289 seconds
  • Memory Usage 2,255KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete