.htaccess 301 redirects

Discussion in 'Linux VPS/Dedicated - General' started by Sherrie, Jun 28, 2013.

  1. Sherrie

    Sherrie Member


    I am trying to setup a 301 redirect and I am having no such luck with it.

    My url structure for my forum goes /forum/vbb/

    I have noticed in webmaster tools that google has found quite a few websites that link to /forum which is giving access denied errors

    I tried to set up a redirect for /forum to my full forum url but instead it causes any url to my forum pages to be redirect to a repeated /forum/vbb/forum/vbb etc url which of course doesn't work!

    Is there any way I can redirect properly?

    Thanks awww.vbulletin.com_forum_core_images_smilies_smile.png
  2. Dan

    Dan Moderator

    Hi Sherrie,

    In the account's cPanel under Domains there is a Redirects applet. Have you tried putting the redirect you want into there?
  3. Sherrie

    Sherrie Member

    I have been editing the .htaccess file, other 301 redirects work fine but for some reason redirecting from /forum or /forum/ doesn't work, it seems to redirect everything pointing to my forum to that wonky url that just keeps repeating itself.

    It couldn't have something to do with a .htaccess in the forum directory with Options All -Indexes in it could it?
  4. Dan

    Dan Moderator

    Hi Sherrie,

    I wouldn't think that Options All would do anything like that, no.

    I assume you have something like this in for the redirect.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain.com/forum$ [OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com/forum$
    RewriteRule ^/?$ http://domain.com/forum/vbb [R=301,L]
    You could always post your redirect here too so that we could look at it :)
  5. Sherrie

    Sherrie Member

    Hello no, these are the rewritecond that I have, the second one was when I was trying to fix my ip (posted in another thread) which didn't work.

    # Force Canonical WWW Rule
    RewriteCond %{HTTP_HOST} !^(www\.mydomain\.com)?$
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]

    # Point IP to Domain
    RewriteCond %{HTTP_HOST} ^67\.222\.3\.40
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [r=301,L]
    # End Point IP to Domain

    My redirect from my index to my forum is just this:

    redirect 301 /index.html /forum/vbb/content.php
  6. Sherrie

    Sherrie Member

    hmmm I also have this: Options Indexes FollowSymLinks
  7. KH-Mathew

    KH-Mathew Systems Administration Staff Member


    If you are getting 401 errors (I assume this is what you meant), then it is likely that there is a rule in .htaccess in the directory that the 301 points to that is causing this. Do you have any allow/deny rules that affect this directory? Can you post the contents of that .htaccess file (the one in /forum/vbb) ? Is the code posted already the entire .htaccess file for the docroot? Also you can use curl to follow the redirects and make sure that they are working as expected (read the cURL docs and consult google on the usage). If you have just moved your vbb installation to this directory, have you checked that file perms and ownership are correct?
  8. Sherrie

    Sherrie Member

    I just enabled the 301 again and this is the error I get when trying to redirect /forum/ to /forum/vbb/content.php

    My url bar looks like this: www.mydomain.com/forum/vbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.phpvbb/content.php

    This now happens when trying to view any page on my website with this redirect enabled.

    With the /forum/ directory there is only one line in the .htaccess which was the Options All -Indexes that I posted earlier.
  9. Sherrie

    Sherrie Member

    Oh and /forum/vbb/ itself has no .htaccess
  10. KH-Mathew

    KH-Mathew Systems Administration Staff Member

    Can you post the contents of .htaccess in the docroot? Also, is mydomain.com the actual site, or did you just use this as an example? Can you post the actual link?

Share This Page