[wp-hackers] How to make root relative urls work in, , , subdomain
Ryann Micua
ryannmicua at gmail.com
Thu Nov 3 07:20:37 UTC 2011
not dumb, I use it too. well, almost. I only have one dev url on my box
http://wp.dev then everything is a subdirectory from there like so:
http://wp.dev/projectname1/, http://wp.dev/projectname2/ I've had no
problems with wordpress with this setup.
I'm guessing you'll probably have a lot of virtual domains by now? and a
pretty big hosts file too =) I don't take my old projects "offline"
which is why I do it the way I'm doing it.
The problem comes up if I'm doing a non-wp project like say I'm just
converting straight from PSD to html/css. On wp, it's no problem since I
refer to my assets (css,js) as <?php echo get_template_directory_uri();
?>/css/style.css basically an absolute url.
But on non-wp projects, I like to use root relative urls so it's now <a
href="/page.html"> Unfortunately it doesn't work straight out if your
root directory is actually a subdirectory of another domain like so
http://wp.dev/nonwpproject/ because the links will point to
http://wp.dev/page.html instead of http://wp.dev/nonwpproject/page.html
which is why this thread is here =)
On Thursday, 03 November, 2011 02:32 PM,
wp-hackers-request at lists.automattic.com wrote:
> I might be completely off base, and this may not be the best way to do
> this, but the method I've been using is to make an entry in my hosts file
> (on my development system) for a URL ending in ".dev" instead of ".com" for
> sites I'm working on - ie,http://example.dev if the real site is
> example.com. Then, I create a virtual domain in Apache to map example.dev
> to the directory I'm using, and restart Apache. It may not be the least
> amount of maintenance, but it takes me almost no time to set it up using
> cut and paste from a previous entry, and it give me a good simulation of
> the final site, with the only difference being I use ".dev" instead of
> ".com". The standard Wordpress .htaccess file works with this setup.
>
> If this is a dumb way to do it, I'm open to change, and I apologize. But
> if it's not obvious, and is something that anyone is interested in, I could
> post details of the setup. I use Ubuntu Linux for both my server and my
> dev system, fwiw.
>
> -Marty Fried
--
*Ryann Micua*
/Web Developer/
------------------------------------------------------------------------
Website: /www.pogidude.com/
Skype: /rmicua/
Mobile: /+639169273059/
More information about the wp-hackers
mailing list