Mike,
Two quick things:
1. Are "local requests" being made on the same computer or have you setup a test server to download to for testing?
This question is to sort out the difference between 151... and 127... IMHO, they should not be mixed (but I stand the possibility of being overruled by Apache.org).
answer: I'm kinda unclear on your question. Say I'm viewing a page from a server on this box - the one i'm typing this reply on. It runs a test server. But I'm using the database on the web host's server - it contains the content. It works for the initial page request because I'm using the .local TLD (unofficial TLD, of course). Since wordpress' database supplies the top nav links, the page I view has links that point to the host's server. But I want the page served up from my test server. I mentioned all this in my post. Reason again.. so I don't have to do a git commit and push to my repository, switch screens to secure shell on the host's server, change branches, cd to the site's dir and pull in the changes... just to see the result.
I think I threw out a red herring, though, sorry. Rewrite and virtual hosting has nothing to do with the prob because that handles incoming requests (even if the request is made from this machine, it's "incoming to the server". It's the hosts file that the browser looks at to determine what to do when I click a link. Just like it caches DNS resolves, it will look at the hosts file to see which IP to send the request to. That's how some malware/adware blockers work. You put the malicious site's URL in the hosts file under 127.0.0.1 or local host and if the page isn't on localhost (either you're not running a server, or it just isn't there) ... So, for example, an ad insertion pointed to by www.example.com/index.html would show a copy of my index.html on the page rather than the ad originally inteded to be there.
I ditched all the vhost and rewrite crap to get back to normal and still didn't get what I wanted, but I need to revisit it. My external database connection occurs in PHP as my local page loads. works fine. The top nav links all point to my domain - the hosted site.
Code:
127.0.0.1 www.example.com
# or
localhost www.example.com # ?? not sure if first field can be a URL
in my hosts file should "redirect" the request to me but now that I think of it, the reference to the external databse "MIGHT" also be redirected back to my test server. In that case - it might be my reason for using
www.example.local
for the local version. You see.. the gotcha is that wordpress settings ask for the site and home URL and sticks it in the database (which would be the external one unless I do an ugly hack) so changing to .local on my test site will just hose things up for the hosted site
implied question: Maybe I can separate the two by specifying / differentiating between the external DB URL and the page URL by specifying the port number, but I'm not sure if the hosts file allows port specifications. hmmm...
needs more thought and I have an appointment to get ready for.
2. <IfModule> wrappers are there to protect ID-10-T's from bringing down the server for unrecognized commands in the configuration file (httpd.conf, httpd-vhosts.conf and .htaccess).
They don't hurt the first two because they're read only upon Apache start but if those are in an .htaccess file, they're very abusive of the server. Test once to be sure whether the module is enabled then remove the wrappers!
reply: Duly noted. Will fix. Where is the stinking end tag? </ifmodule>
I think wordpress wrote that in when I turned on pretty permalinks, 'cause I sure as hell didn't write that. I cut out and moved WP's rewrite rule (I surrounded it with the # begin/end wordpress comment, but may have screwed up when I wrote the bit to allow file uploads. I'll fix that.
I guess by "test once" you mean that if it seems to work, call it good.
So... my appointment. Gottta run, but thank you for your time. Maybe this will be resolved soon.
Mike -- crap! no preview link for quoted replies. hope and click, edit and preview
Regards,
DK
Bookmarks