If the site is going to be in the root of a domain, another possible solution (tip by Ed at ISI) would be:
- install test/dev sites in the root, not in a subfolder (use subdomains)
- change the WebSite URL setting to /
Note that since GS 3.1 you are not allowed to enter a non-URL path there, so you'll have to:
- edit your website.xml file to change it
or
- patch GS to make it allow to change it in the backend: edit admin/settings.php, find the string type="url" and change it to type="text"
(as I suggested here, but now it's line 217)
This way all your links, img tags, etc. will be relative to root and will work on all sites.
There's a small issue with this: canonical URLs will not be correct (complete). To fix it, you can either
- remove the canonical tag by changing get_header() to get_header(false) in your template
or
- in the final site, set the correct WebSite URL (e.g. http://www.example.com/) (if/when you've finished develoment)
----
This method could be also used for developing in a subfolder if all local/dev sites use the same folder name, e.g. testsite and you set /testsite/ as Website URL. When the site is ready to be public, you'd have to do the find/replace /testsite/ by http://www.example.com/ (if/when you've finished develoment)
- install test/dev sites in the root, not in a subfolder (use subdomains)
- change the WebSite URL setting to /
Note that since GS 3.1 you are not allowed to enter a non-URL path there, so you'll have to:
- edit your website.xml file to change it
or
- patch GS to make it allow to change it in the backend: edit admin/settings.php, find the string type="url" and change it to type="text"
(as I suggested here, but now it's line 217)
This way all your links, img tags, etc. will be relative to root and will work on all sites.
There's a small issue with this: canonical URLs will not be correct (complete). To fix it, you can either
- remove the canonical tag by changing get_header() to get_header(false) in your template
or
- in the final site, set the correct WebSite URL (e.g. http://www.example.com/) (if/when you've finished develoment)
----
This method could be also used for developing in a subfolder if all local/dev sites use the same folder name, e.g. testsite and you set /testsite/ as Website URL. When the site is ready to be public, you'd have to do the find/replace /testsite/ by http://www.example.com/ (if/when you've finished develoment)