vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   htaccess 301 redirect assistance (https://vborg.vbsupport.ru/showthread.php?t=302315)

xAnacondax 09-15-2013 11:35 AM

htaccess 301 redirect assistance
 
First off... I've been searching around trying to do my homework on how to do this, and I found an example, but I'm not confident I understand the coding well enough to customize it for my current domain. We moved our forum from a subdirectory (http://www.example.com/forum) to the root (http://www.example.com) and ever since we've had issues with ajax functionality on the board both with some built in features of VB and by extension those plugins that use ajax to function. Looking at my cpanel logs leads me to believe that the files/database are looking for that old directory and getting a 404 error. I wanted to see if there was an easy to understand resource that I can go by in order to set up a redirect from the old directory path to my current one and see if it fixes the issues.

Namely, how to enter the redirect properly in the htaccess file...
And where to put it.... whether it should be inside the root folder (http://www.example.com) or within the (http://www.example.com/forum) directory. Unfortunately I'm suddenly needing to deal with extrememly limited experience and I want to make sure I have it right the first time since I'm fixing a live website.


Any help would be greatly appreciated

kh99 09-17-2013 10:30 AM

It seems like you should be able to get things working without using a redirect (except to get existing links to point to the new forum, of course). Did you try Maintenance > General Update Tools > Rebuild Styles?

Spangle 09-17-2013 12:03 PM

If you are getting a 404 error then you need to set up a redirect for that, it will also cure any other 404's that may crop up.

any redirects should go in the .htaccess file, that way it becomes a server side demand, and it wont be noticed at all by the user.

to setup a 404 redirect you only need to add one line to your .htaccess

ErrorDocument 404 /index.php

If your files were on the same server, you shouldn't need to do a redirect, just move all of the files out of the forum folder, into public_html, all you should need to do then is alter some settings like the the image paths in the ACP.

If you must have a redirect, then add this to your .htaccess

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html


All times are GMT. The time now is 05:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00973 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete