Domain forwarding, masking and links
-
Hi Folks
I have set up a blog using WP2.1, say at https://www.mysite.com/myblog
Then I set up a domain, mydomain, forwarded to this address, and enabled masking (using godaddy).It all works fine, except that if someone wants to link to it, then they will end up using the mysite link (eg if they right click on a link and do ‘Copy Shortcut’).
The problem is that if the site is ever then moved to a different host, the links will break. If I manually take one of the links and replace the mysite.com/myblog with mydomain the links work fine, but I cannot expect folks linking across to do that.
I tried using the custom formatting for permalinks but that only lets you change the second part of the URL format, not the start of the URL.
I tried changing the two path options in admin / options / general, but they either broke the themes or links. I started tracking the theme down – its something to do with the style sheet not being found – but there were other problems so I changed back to those urls being https://www.mysite.com/myblog.
Then I started looking at how links were made – I made a ‘customhome’ option in the get_option function, which returned the mydomain URL instead of the site URL, and changed all the get_option the calls in link-template.php to use this instead.
This got the post links and the archive links to work as I wanted. However, categories were still the old mysite versions, as were some other things.
So my question is, can I make the permalinks have the mydomain version of the links, for all the obvious places, such as post links, category links and so on?
If not, will the changes I have made to link-template.php have any unintended consequences? I changed the get_option calls to use my ‘customhome’ variant instead of ‘home’
In the end it started getting messy, and I wasn’t sure if it was going to break things like RSS feeds.
I really don’t want to have to get set up another site being hosted, so I wondered if there was another way to do what I want?
Cheers
Jeremy
- The topic ‘Domain forwarding, masking and links’ is closed to new replies.