Hello, I am not sure if this is the fitting place for this, so feel free to move this if it's the wrong place.
I am having a small problem with mod_rewrite Apache module.
I am trying to setup a rather simple vhost using mod_rewrite (I have already setup the DNS), since I don't have access to the httpd.conf
I have this:
The problem with this is that since the HTTP_HOST doesn't change after the rewrite, when the new URI is rewritten, the RewriteCond again matches, thus this results into an unlimited loop and furthermore to an invalid setup.
I want to know the best way to solve this problem, I did come up with a small fix myself, but I find it an ugly workaround, and would much rather use a better solution, if there is any.
My solution was to make another condition for the rewrite, that checks if the REQUEST_URI is in the directory of the document root. If it is, it won't rewrite the URL again:
The problem with this is that if I happened to have a same named directory inside the rewritten docroot, it wouldn't work. Yes, unlikely, but possible.
So anyways, if you have any better ideas, please let me know. (Also, I am going to turn this into map file later to support multiple vhosts easily, but I am just trying to setup the base framework now).