When I use this code, it works just okay:
<IfDefine ${ServerBase}>
RewriteBase ${ServerBase}
</IfDefine>
But when I add this, it always uses RewriteBase \
which was not what I want.
<IfDefine !${ServerBase}>
RewriteBase /
</IfDefine>
The condition was already different. One of them when ServerBase is defined and one of them is when ServerBase is NOT defined. How can I use IfDefine else pattern with RewriteBase?
IfDefine
checks whether a parameter is defined or not. It doesn't check it's value.
You need to use it as:
<IfDefine ServerBase>
RewriteBase ${ServerBase}
</IfDefine>
<IfDefine !ServerBase>
RewriteBase /
</IfDefine>
Note use of ServerBase
instead of ${ServerBase}
.
来源:https://stackoverflow.com/questions/53712313/ifdefine-and-rewritebase-doesnt-work-well-together