
|
[dokuwiki]
||
[Date Prev]
[09-2007 Date Index]
[Date Next]
||
[Thread Prev]
[09-2007 Thread Index]
[Thread Next]
[dokuwiki] Re: dokuwiki htaccess rules in conflict with other domain rewrites?
- From: Markus Frosch <markus@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 07 Sep 2007 09:41:08 +0200
Hi Ryan
hm I missed this "merging" part of documentation...
All my experience with mod_rewrite shows me that local rules overwrites
the rules from parent directories.
Maybe this feature will be implemented in the future.
But you should not rely on this at the moment ;-)
Markus
Ryan Jacobs schrieb:
> Hi Markus!
>
> Thanks very much for the reply.
>
> hummm, I'm getting conflicting info as I scour Google more and see this
> reply. I think there is one fundamental htaccess rule/concept that is
> alluding me (I hope this is not going to be embarrassing for me):
>
> If you have a .htaccess file in a domain root, and then one in a
> subdirectory, how are their rules merged/combined/ordered?
>
> apache.org documentation seems to imply that they are combined such that
> rules defined in parent dir .htaccess files can override rules in child
> .htaccess files. It seems to say that the rules merge/combine AND cascade.
>
> However, your post, my experience, and a couple other sites I've read
> seem to imply that the lowest .htaccess file found is THE ONE AND ONLY
> .htaccess file, and any that rules that exist in .htaccess files in
> parent directories are just ignored completely.
>
> Maybe the latter only applies for things like rewrites, but not for
> other directives (like "options", etc.).
>
> I hope I've been able to justify my confusion here... without
> embarrassing myself too much (I though I had already wrapped my head
> around the basics of apache rewrites and directives).
>
> Thanks!
> Ryan
>
> Markus Frosch wrote:
>> Hello Ryan,
>> I'm not sure what your problem is with this rewrite issue...
>>
>> It's just logical to replace any parent rewrite rules if local rules are
>> existing. Just imaging what happens if Apache "merges" these rules. It
>> would end up in a chaotic configuration...
>>
>> You should be able to solve the problem by adding the following as one
>> of the first rules to Dokuwiki's .htaccess:
>>
>> RewriteCond %{HTTP_HOST} !^mydomain.com$ [NC]
>> RewriteRule ^/dokuwiki(.*)$ http://mydomain.com/dokuwiki$1 [L,R=301]
>>
>> What do you think? :-)
>>
>> Markus Frosch
>>
>> Ryan Jacobs schrieb:
>>> Hello!
>>>
>>> I really hope this is an appropriate place to ask this question, as I
>>> think it might be more apache rewrite-specific that dokuwiki-specific,
>>> but I'm just not sure, and am hoping someone out there may shed some
>>> light on things. I've scoured Google, but have only found a couple cases
>>> of similar problems, but no actual solutions...
>>>
>>> Basically I have a dokuwiki install rooted in a subdirectory of my
>>> domain (http://mydomain.com/dokuwiki), all of which is hosted on a
>>> shared commercial host (not my own server). I have URL rewriting setup
>>> using an .htaccess file in my /dokuwiki folder and the standard rewrite
>>> rules for a dokuwiki install (found at
>>> http://wiki.splitbrain.org/wiki:rewrite and using "RewriteBase
>>> /dokuwiki").
>>>
>>> My problem arises when I try to setup some other domain-wide rewrite
>>> rules in another .htaccess file at the root of the domain
>>> (http://mydomain.com/). These new rules function for any directory in my
>>> domain EXCEPT my dokuwiki installation at /dokuwiki. For example I use
>>> the following in the domain root .htaccess to remove the www from all
>>> domain requests:
>>>
>>> RewriteEngine On
>>> RewriteBase /
>>> RewriteCond %{HTTP_HOST} !^mydomain.com$ [NC]
>>> RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]
>>>
>>> A request to http://www.mydoman.com/somefolder/ redirects to
>>> http://mydoman.com/somefolder/, but http://www.mydoman.com/dokuwiki/
>>> DOES NOT redirect. However if I turn off Dokuwiki rewriting and remove
>>> my /dokuwiki/.htaccess file, then http://www.mydoman.com/dokuwiki/ DOES
>>> redirect to the non-www version.
>>>
>>> I read that apache has to do some tricky things to manage paths when
>>> processing per-directory .htaccess rules (hence the RewriteBase), so
>>> maybe there is some conflict here? Or perhaps there is something in the
>>> default Dokuwiki .htaccess rules that somehow conflicts with .htaccess
>>> rules higher up in the tree (though I didn't think that was possible)?
>>>
>>> Sorry again if this is very apache specific, but I have to start
>>> somewhere, and am perhaps a bit over my head at the moment.
>>>
>>> Thanks and cheers,
>>> Ryan
>>>
>>
>>
>> Gruß
>> Markus Frosch
--
markus@xxxxxxxxxxxxx
http://www.lazyfrosch.de
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
|

|