Can there be anyway to make use of PHP to determine the worth of
AllowOverride too find out if
.htaccess will work?
I'm not conscious of a clean, direct method of doing this.
For those who have http use of the folder you need to take a look for, you can write something in to the .htaccess file which will trigger a particular type of output.
For instance, you can set a header (it has an additional reliance upon
<FilesMatch ".(php)$"> <IfModule mod_headers.c> Header set htaccess_works "yes" </IfModule> </FilesMatch>
make a request from PHP, and appearance the response headers, e.g. using
CURLOPT_HEADER. When they retain the
htaccess_works header, it really works.
Another method that's terrible but certain to work individually from specific Apache modules would be to programmatically write gibberish in to the
.htaccess file, then to create a curl request like above, and also to look into the
500 status code. Whether it throws a 500, the .htaccess file got construed. But as stated, this really is terrible - if at all possible, opt for the headers method rather.
In complement to @Pekka response:
AllowOverride could be set to None or All, but too to some specific listing of terms: AuthConfig, FileInfo, Indexes, Limit, Options. So you may be permitted to utilize a Header instruction although not Deny, for instance.
So a method to test the actual worth of AllowOverride would be to add this for your .htaccess:
#AuthConfig AuthName "Secret" #FileInfo ErrorDocument 404 index.php #Indexes DefaultIcon /icon/unknown.xbm #Limit Allow All #Options Options FollowSymLinks
Then for those who have an 500 error comment lines to identify which words (sections) are forbidden. You will get a mistake 500 before you remove every forbidden instruction. When you know the permitted sections you will need to look into the documentation for that complete listing of permitted instructions.
If you don't have error you've AllowOverride None or All. Then affect the Deny/Let it:
If you possess the 403 result it is a AllowOverride All.