Relative vs. absolute href links
Since nobody spoon-fed an answer, I hacked one up (and it’s not as bad as what I initially described). Perhaps this will help somebody:
I wrote a WP plugin called link-chameleon that hooks into the wp_nav_menu filter hook. Assuming the operative $_SERVER[SERVER_NAME] is in my list of domains, the bloginfo(‘siteurl’) portion of all links is replaced by $_SERVER[SERVER-NAME]. A second function in the plugin checks whether it’s a URL that requires hiding the contact page, and filters out that link if so. This takes care of the menus, but not all other links. In my case there aren’t very many (it’s not a blog site), so it’s no big deal – I just had to hack my header.php and footer.php.
Then it hit me that robots.txt was also a loose end. I really only want one of the domains indexed. I created robots.txt.php, which generates URL appropriate content. I added a RewriteRule to .htaccess to redirect robots.txt requests to robots.txt.php. In order to prevent WordPress from generating the robots.txt output, I had to create a dummy robots.txt file, which is duly ignored due to the RewriteRule.
- The topic ‘Relative vs. absolute href links’ is closed to new replies.