Originally Posted by requinix
Ah, seems I was slightly mistaken. There's a barrier between the main server configuration and virtual hosts.
I can't find it in the current docs (I think it's slightly changed from 2.2 to 2.4) but http://httpd.apache.org/docs/2.2/mo...ite.html#vhosts
In my defense I'm not used to putting rules in the httpd.conf - I've always seen them in the virtual host configuration and .htaccess files.
Good info. Putting that in both files overcame that problem, but revealed another one. All in all, not worth the trouble. I'll just keep the www. prepend rewrite in the .htaccess file. Feels dirty, but I have enough battles to fight that this one isn't that important.
If you're morbidly curious what the next problem was...
The .htaccess rewrites running first, the URL was being rewritten "internally". Meaning PHP would see conventional query string arguments while the browser would retain the "pretty URL".
Problem is: when the vhost rewrites ran and performed a redirect to add www. in the browser, it also pushed the "internal" form of the URL into the browser. It functions, but negates the purpose of the prettier URLs.
Long story short, the www. prepend rewrite HAS to happen first, which means putting it in the .htaccess file before the other rewrites.
Not a big deal, really. I'm just being a bit anal about keeping the URL pretty since it's news/blog/forum site I hope will have its URLs shared around.
Thanks for the help! Seems we at least both learned a bit about the inheritance piece.
| In my defense I'm not used to putting rules in the httpd.conf - I've always seen them in the virtual host configuration and .htaccess files. |
Just noticed this piece. I'm actually dealing with vhost entries and not httpd.conf itself. In terms of execution I figured httpd.conf/vhosts would be the same, with .htaccess being the odd man out.
Plus Googling the problem revealed a lot of people mentioning httpd.conf and nobody mentioning vhosts, so I thought they were synonymous in this context.
Anyway, it looks like there's still a different between execution of .htaccess and vhosts, so we worked through it the same way, anyhow.