Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Moving Vanilla from Subdirectory to Subdomain

aeryaery ✭✭✭
edited March 2012 in Vanilla 2.0 - 2.8

I have vanilla forum as subdirectory along with my blog at www.gtricks.com/forum

After the recent panda attack and talking to few SEO masters, they advised me to move to subdomain as it will be treated differently by Google and help me recover.

I have some 200 threads and 1000 users on the forum which I would like to move to a subdomain.

Effectively, I want to move from www.gtricks.com/forum to forum.gtricks.com

Does Vanilla provides this functionality like the wordpress? What should I do. Is simple htaccess modification like shown below enough?

RewriteEngine on RewriteRule ^forum/(.*) http://forum.gtricks.com/$1 [R=301,NC]

There was an error rendering this rich post.

Best Answers

  • x00x00 MVP
    edited March 2012 Answer ✓

    I would do

    RedirectMatch 301 /forum(/.*)? http://forum.mysite.com$1?redirection=1

    then in /dashboard/routes -> Add

    Route Expression
        (/?[^\?]*)\?redirection=1
    Target
        $1
    Type
        Permanent (301)

    After this do another one

    Route Expression
        \?redirection=1
    Target
        /
    Type
        Permanent (301)

    This is for those that are using friendly urls, it will redirect everything, if there is an additional query string it will just redirect to the method and parameters minus the query arguement.

    grep is your friend.

  • edited September 2013 Answer ✓

    Moving a forum from a directory to a sub-domain should be easy, let me try to help. From what I know, there are two ways to move a Vanilla Forum from a sub-directory to a sub-domain.

    Make a backup of your forum first. I don't want you to complain if anything goes wrong. :)

    METHOD-1: The Easy-Peasy way — If it works, it works. So, try this one first.

    [1] First create a sub-domain relative to the vanilla forum installation directory, so that http://sub.domain.com points to http://domain.com/vanilla/. This should be very easy of you have Cpanel control panel installed.

    [2] Change the code in the .htaccess file inside your vanilla forum directory to this. Yes, it should be exactly this:

    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /. 
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       # RewriteBase /
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    Do you see the difference from the existing code in your .htaccess file? It's the 6th line. It should just be / and not /forum because you are actually going to access your forum from a sub-domain, which in a way, works like a domain.

    Now, go to your forum from http://sub.domain.com and login to your dashboard. Do you see Here's how to get started: section? Inside that, you'll see something like this:

    2. Where is your Community Forum?
    Access your community forum by clicking the "Visit Site" link on the top-left of this page, or by clicking here. The community forum is what all of your users & customers will see when they visit http://sub.domain.com/.

    If you see http://sub.domain.com/ there, you can consider that your forum has moved.

    METHOD-2: The hard way, but almost guaranteed to work

    You'll need to make a fresh install of Vanilla Forum on a sub-domain, then import the tables, and static files (images & others) from your existing forum.

    This is meant to be a pointer. I am not explaining this hoping that METHOD-1 will work for you.

    EDIT: You also need to setup 301 redirection from domain.com/directory/ to sub.domain.com if you don't want to lose any pagerank or traffic coming from search engine-indexed links.

    I repeat, I am not 100% sure of these methods. I didn't even try these. But when I checked the differences between my two forum installations — one on a sub-domain and another on a sub-directory, the .htaccess files were (almost) the only ones that were different.

    Hope that helps! :)

Answers

  • i use virtual server definitions in apache config to accomplish this.

  • aeryaery ✭✭✭

    Can you please post the guide to accomplish this? It would be very helpful for other too.

    There was an error rendering this rich post.

  • x00x00 MVP
    edited March 2012

    host file (/etc/hosts)

    127.0.0.1 sub.localhost

    httpd.conf (/etc/apache2/httpd.conf/)

    <VirtualHost *:80>
      ServerName sub.localhost
      DocumentRoot "/var/www/sub/"
      DirectoryIndex index.php index.html index.html index.htm index.shtml
    </VirtualHost>
    

    Restart apache

    ~ $ sudo /etc/init.d/apache2 restart

    However I'm guessing you are are a shared host in which case you won't be able to do this.

    grep is your friend.

  • x00x00 MVP
    edited March 2012

    First of all you have to consider the impact of such a move, especially if you already have a google rank for /forum, you will need to do 301 redirect from /forum to forum.yourdomain.com.

    secondly you have to figure out how you are goign to do this based on current restrictions.

    lastly there are a lot of bullshitters in SEO. Yes they can be certain advantages to doing something, however there is also there overall stability of you reputation/rank to take into consideration.

    grep is your friend.

  • aeryaery ✭✭✭

    I understand the risk associated with it and I am ready to take for the sake of better reputation on the long run.

    For all webmasters - its better to have subdomain while making a forum on your main site as Google now heavily penalizes thin content sites and most of the forum threads are user generated content with less value to offer. Though their are exellant conversations in some threads but those do not justify all low quality content on forum.

    @x00 unfortunately, i am in shared host. I am ready to take the risk and start the forum all again. I think it will be better for long run. Please advise a method to achieve this. Your help will be of great value to everyone.

    There was an error rendering this rich post.

  • Can u show evidence over subdomain vs folder. From wht i have read subdomains get penalised more.

    There was an error rendering this rich post.

  • aeryaery ✭✭✭

    b. If you accept user-generated content on your site (like an online forum), move it to a separate sub-domain.

    via http://blogs.wsj.com/indiarealtime/2012/01/12/tech-journal-five-ways-to-improve-your-blog/

    Matt Cutts came on the scene Post-Panda and told HubPages to “try subdomains”

    via http://www.whitefireseo.com/site-architecture/subdomain-or-subfolder-post-panda/360/

    and http://www.conversationmarketing.com/2011/07/wsj-wtf-google-panda-subdomains.htm

    There was an error rendering this rich post.

  • x00x00 MVP
    edited March 2012

    it shouldn't be too much hassle. Create the subdomain through your sp. Install vanilla in the sub directory. it document root should be /forum

    if you have blank subdiredtory you would like to redirect e.g /forumother you need .htaccess in that folder to redirect

    RedirectMatch 301 /forumother(/.*) http://forum.yoursite.com$1

    I found through trial an error it is best not to use

    RedirectMatch 301 /forum(/.*) http://forum.yoursite.com$1

    inside the working forum (top of the .htaccess). The reason is that due to internal redirect you will get an additional query string appended (like /discussions?p=discussions). Instead make use

    RedirectMatch 301 /forum(/.*) http://forum.localhost$1?

    Note the ?

    alternatively you could redirect to /forumother

    RedirectMatch 301 /forum(/.*) /forumother$1

    and have that redirect to the sub directory.

    grep is your friend.

  • aeryaery ✭✭✭

    So @x00 you mean to say that

    1) Create a subdomain example forum.mysite.com that points to current vanilla folder location that is mysite.com/forum

    2) edit .htaccess in subfolder and write

    RedirectMatch 301 /forum(/.*) http://forum.mysite.com$1?

    3) Vanilla will take care of everything else.

    All my articles like gtricks.com/forum/discussion/192/google-launched-google-play-the-digital-content-store/ will be automatically converted and recognized by Google as foeum.gtricks.com/discussion/192/google-launched-google-play-the-digital-content-store/

    There was an error rendering this rich post.

  • aeryaery ✭✭✭

    @x00 is this the correct way? Should I implement it?

    There was an error rendering this rich post.

  • x00x00 MVP
    edited March 2012 Answer ✓

    I would do

    RedirectMatch 301 /forum(/.*)? http://forum.mysite.com$1?redirection=1

    then in /dashboard/routes -> Add

    Route Expression
        (/?[^\?]*)\?redirection=1
    Target
        $1
    Type
        Permanent (301)

    After this do another one

    Route Expression
        \?redirection=1
    Target
        /
    Type
        Permanent (301)

    This is for those that are using friendly urls, it will redirect everything, if there is an additional query string it will just redirect to the method and parameters minus the query arguement.

    grep is your friend.

  • It is ok to chain 301 redirect so long as there aren't too many, this was from google's own advice.

    grep is your friend.

  • edited September 2013 Answer ✓

    Moving a forum from a directory to a sub-domain should be easy, let me try to help. From what I know, there are two ways to move a Vanilla Forum from a sub-directory to a sub-domain.

    Make a backup of your forum first. I don't want you to complain if anything goes wrong. :)

    METHOD-1: The Easy-Peasy way — If it works, it works. So, try this one first.

    [1] First create a sub-domain relative to the vanilla forum installation directory, so that http://sub.domain.com points to http://domain.com/vanilla/. This should be very easy of you have Cpanel control panel installed.

    [2] Change the code in the .htaccess file inside your vanilla forum directory to this. Yes, it should be exactly this:

    <IfModule mod_rewrite.c>
       RewriteEngine On
       # Certain hosts may require the following line.
       # If vanilla is in a subfolder then you need to specify it after the /. 
       # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
       # RewriteBase /
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    Do you see the difference from the existing code in your .htaccess file? It's the 6th line. It should just be / and not /forum because you are actually going to access your forum from a sub-domain, which in a way, works like a domain.

    Now, go to your forum from http://sub.domain.com and login to your dashboard. Do you see Here's how to get started: section? Inside that, you'll see something like this:

    2. Where is your Community Forum?
    Access your community forum by clicking the "Visit Site" link on the top-left of this page, or by clicking here. The community forum is what all of your users & customers will see when they visit http://sub.domain.com/.

    If you see http://sub.domain.com/ there, you can consider that your forum has moved.

    METHOD-2: The hard way, but almost guaranteed to work

    You'll need to make a fresh install of Vanilla Forum on a sub-domain, then import the tables, and static files (images & others) from your existing forum.

    This is meant to be a pointer. I am not explaining this hoping that METHOD-1 will work for you.

    EDIT: You also need to setup 301 redirection from domain.com/directory/ to sub.domain.com if you don't want to lose any pagerank or traffic coming from search engine-indexed links.

    I repeat, I am not 100% sure of these methods. I didn't even try these. But when I checked the differences between my two forum installations — one on a sub-domain and another on a sub-directory, the .htaccess files were (almost) the only ones that were different.

    Hope that helps! :)

  • I can confirm that METHOD-1 is working! @aery tried it, and it seems to have worked.

  • edited March 2012

    @x00 : Thanks for the redirection how-to. But the last step creates a redirection loop and the second step doesn't seem to be necessary.

    All I had to do was add this in '/vanilla-forum-root/.htaccess' :

    RedirectMatch 301 /forum(/.*)? http://forum.mysite.com$1?redirection=1
    

    That's it. Your forum should now be redirecting fine. Absence of the query string in the redirection rule appears to break the friendly URLs.

    @x00 Do let me know if what I am doing is wrong (or has any gotchas!). Thanks.

  • ok my method has the vanilla installed on the subdomain, and that is already set up to point to /forum/

    RedirectMatch 301 /forum(/.*)? http://forum.mysite.com$1?redirection=1

    is added to to the top of the .htaccess

    then you must follow these instruction to the letter:

    then in /dashboard/routes -> Add

    Route Expression
        (/?[^\?]*)\?redirection=1
    Target
        $1
    Type
        Permanent (301)

    After this do another one

    Route Expression
        \?redirection=1
    Target
        /
    Type
        Permanent (301)

    This is for those that are using friendly urls, it will redirect everything, if there is an additional query string it will just redirect to the method and parameters minus the query argument.

    the order is important

    grep is your friend.

  • edited March 2012

    For those of you (you wanted this @aery ) who want to redirect www.forum.example.com to forum.example.com, here are the .htaccess rules.

    #Redirects www sub-domain to non-www version
    RewriteEngine On
    RewriteCond %{http_host} ^www.forum.example.com
    RewriteRule ^(.*)? http://forum.example.com/$1?redirected [R=301,L]
    
  • Hi, the 301 redirect works well, but specifically my problem is that I have a sub directory /community and I want it to redirect to a subdomain i created. Example www.mysite.com/community to www.forums.mysite.com. Without renaming the /community, I want it to point to the subdomain. How can I achieve this? Any help is much appreciated. is much appreciated.

  • The situation you’re in is something related to on-page optimization. Migrating the files from www.gtricks.com/forum to forum.gtricks.com won’t help. You need to download the infected files, refine them with better quality content and upload the files to the sub-domain location. The articles I’ve listed below should help you recover from the Google Panda update.

    https://www.searchenginejournal.com/seo-guide/google-penguin-panda-hummingbird/
    https://en.wikipedia.org/wiki/Google_Panda
    http://www.sevenatoms.com/blog/how-to-stop-worrying-about-google-algorithm-changes/
    https://www.searchenginejournal.com/seo-guide/google-penguin-panda-hummingbird/

Sign In or Register to comment.