Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16

Base Href

This is a discussion on Base Href within the General Discussion forums, part of the vBSEO SEO Plugin category; Is it possible to turn off the <base href= http://www.mydomain.com > statement that gets inserted by vBSEO ? I am ...

  1. #1
    Junior Member
    Real Name
    Bob
    Join Date
    Sep 2007
    Posts
    25
    Liked
    0 times

    Base Href

    Is it possible to turn off the <base href=http://www.mydomain.com> statement that gets inserted by vBSEO?

    I am trying to set up a mobile version of my forum on a subdomain m.mydomain.com using the mobile detection and mobile style:
    Mobile, Cell, Phone, PDA, iPhone Style - vBulletin.org Forum

    However, it appears that vbseo is preventing this by adding the base href at the top of the page and sending visitors back to the main version of the site.

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,741
    Liked
    168 times
    If you have "Include Domain Name in URLs" option enabled in vBSEO CP, it should work correctly without it. Try to modify functions_vbseo.php file:
    find:
    PHP Code:
    if(
    VBSEO_BASEDEPTH &&
    defined('VBSEO_PREPROCESSED')

    replace with:
    PHP Code:
    if(0

  3. #3
    Junior Member
    Real Name
    Bob
    Join Date
    Sep 2007
    Posts
    25
    Liked
    0 times
    Thanks. That works for the mobile subdomain, but now damages the css and image links for the main site. The CSS linked files no longer work and some images fail to load (but not all of them).

    It looks a bit messy. Is there a way to fix this without going through and modifying all of the templates?

  4. #4
    Junior Member
    Real Name
    Bob
    Join Date
    Sep 2007
    Posts
    25
    Liked
    0 times
    I have done a temporary bodge by replacing the line after the if clause with:

    Code:
    $myDomain = $_SERVER['SERVER_NAME'];
    $newtext = preg_replace('#<head>#i', "$0\n".'<base href="'.$myDomain.(defined('VBSEO_BASE_URL')?VBSEO_BASE_URL:'').'/" />', $newtext, 1);
    That seems to work perfectly now.

  5. #5
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,741
    Liked
    168 times
    You can use this code to exclude <base> for mobile domain only.
    PHP Code:
    if(
    VBSEO_BASEDEPTH &&
    defined('VBSEO_PREPROCESSED')
    && (
    $_SERVER['HTTP_HOST'] != 'm.mydomain.com')

    Edit: I'm glad it works for you now.

  6. #6
    Junior Member
    Real Name
    Bob
    Join Date
    Sep 2007
    Posts
    25
    Liked
    0 times
    A minor alteration required. I forgot the 'http://' before the domain, so it works in IE but not Firefox.

    Code:
    $myDomain = $_SERVER['SERVER_NAME'];
    $newtext = preg_replace('#<head>#i', "$0\n".'<base href="http://&#39;.$myDomain.(defined(&#39;VBSEO_B...;&#39;).&#39;/" />', $newtext, 1);

  7. #7
    Junior Member
    Real Name
    GEORGE
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    24
    Liked
    1 times
    Hi Oleg is there an update for this work around for vBSEO 3.3.2 ? Thanks

  8. #8
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,741
    Liked
    168 times
    The same modification should be working.

  9. #9
    Member
    Real Name
    Mike
    Join Date
    Nov 2007
    Posts
    35
    Liked
    0 times
    Is there anyway to have this work but still have "Include Domain Name in URLs" turned on?

  10. #10
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times

    Eeekkk..... Oleg?

    Hey Oleg...

    I am using this code in the latest includes/functions_vbseo.php
    Code:
    if($url[0]=='#')
    {
    return
    $preurl .
    ( (VBSEO_BASEDEPTH && defined('VBSEO_PREPROCESSED') && $_SERVER['HTTP_HOST'] != 'm.xxxxxxxx.net') ? htmlspecialchars(VBSEO_REQURL_FULL) : '' ).
    $url . $posturl . $intag . $closetag
    ;
    }
    Everything looks totally perfect, but I am still getting the base href coming through to screw it all up :(

    Any ideas? (3.5.0)
    Last edited by rob; 06-07-2010 at 05:37 PM.
    Rob - SEO Specialist

  11. #11
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times
    scrap that.... I was being rather stupid indeed
    Rob - SEO Specialist

  12. #12
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times

    Oleg...

    I've used Oleg's suggestion and also swissbob's too.
    No base href is added on the homepage, but for all other pages, a base url appears.

    I dunno how to fix this issue... any ideas?
    Rob - SEO Specialist

  13. #13
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times
    It now dawns on me that you moved your file structure in 3.5.0... grrrr.

    All fixed n sorted now and feel free to tidy this thread up..
    Rob - SEO Specialist

  14. #14
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,741
    Liked
    168 times
    Glad you got it working

  15. #15
    Senior Member
    Real Name
    Ben Griffiths
    Join Date
    Apr 2006
    Location
    Taipei
    Posts
    154
    Liked
    6 times
    Quote Originally Posted by Rukas View Post
    Is there anyway to have this work but still have "Include Domain Name in URLs" turned on?
    Was this ever resolved, I'm running into that problem now...

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Two instances of 'base href'
    By Chris-777 in forum General Discussion
    Replies: 2
    Last Post: 05-17-2007, 01:28 PM
  2. <base href entfernen
    By Willy in forum Deutsch
    Replies: 2
    Last Post: 05-13-2007, 01:04 AM
  3. href base
    By John_The_Comingman in forum Deutsch
    Replies: 1
    Last Post: 06-15-2006, 02:45 PM
  4. Base href?
    By Ace Shattock in forum Bug Reporting
    Replies: 5
    Last Post: 08-11-2005, 07:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •