WordPress.org

Ready to get started?Download WordPress

Forums

Possible dangerous "hack" ... change all links to be relative (2 posts)

  1. e-head
    Member
    Posted 9 years ago #

    I have an odd need to change all absolute links displayed by wordpress to relative.

    For whatever reason when I try and change blog address to "", wp won't let me. Same thing for wordpress address. It seems it insists on a well formed URI.
    What I've done is searched for all occurances of get_settings('home') and "whacked" them. That is, replaced this function call with nothing.
    In all cases this call was the first in a long catenated string.

    This seems to have worked (I only touched templates-categories and templates-link files),
    but is something going to go haywire ?

    Anybody got a better idea ?

    A little sql diddy could probably change this 'home' variable to "nothing" ... but I'm sort of retarded when it comes to that stuff.

    // BullShit
    I want to have 2 or 3 different blogs.
    One blog is the "master" blog, and displays all posts. The other blogs don't know about the "master" blog.

    The "secondary" blogs are actually single categories of the "master".

    This is my angle:
    I used DynDNS to set up several sub-domains for site:
    tech.mydomain
    life.mydomain
    pictures.mydomain
    etc ...
    I set up apache2 with several virtual hosts ...
    though all this could probably be done with .htaccess files too ...

    my biggest problem is getting all links to be displayed as relative ... so that the "referer" is preserved ... that is , tech.mydomain stays tech.mydomain.

  2. e-head
    Member
    Posted 9 years ago #

    o.k.,

    this would have been much simpler:

    I just added the following line to the get_settings function (in file functions.php) , up at the top:

    if ('home' == $setting) return "";

    this is an easy "hack" and easy to undo.

    anybody got any reason why i shouldn't do this ?

    it appears to have made all links relative ...
    all category, single-post, rss, etc ....
    all in one shebang.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.