Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: [Solved] Option not allowed in .htaccess |
|
Author |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1266 Location: Amsterdam, NL, EU
|
Posted: Tue 11 Dec '18 12:13 Post subject: [Solved] Option not allowed in .htaccess |
|
|
In our Apache config only some Options are included in the AllowOverride list. If you disable CGI Access for a domain in Directadmin it is not allowed to override ExecCGI for that domain. A .htaccess (generated from a template) contained the following lines:
Code: | <IfModule mod_cgi.c>
Options -ExecCGI
</IfModule>
|
This was causing an Error 500: Option ExecCGI not allowed here
Workaround was to allow CGI Access, only to be able to disable it in .htaccess. There must be better ways to do this.
1. Is there a way in .htaccess to know if ExecCGI is on?
2. Is there a way in .htaccess to detect if we are allowed to Override ExecCGI?
Last edited by Jan-E on Mon 20 Jun '22 18:26; edited 1 time in total |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 11 Dec '18 16:42 Post subject: |
|
|
Hi Jan,
I haven't tested it, but I can think of an "If expression".
Code: |
<If "%{HANDLER} == 'cgi-script'">
Require all denied
</If>
|
What I already tested as working in REAL WORLD is
Code: |
<If "%{HTTP_HOST} == 'stage.example.com'">
AuthType basic
AuthName "private"
AuthUserFile /home/example/.htpasswd
Require valid-user
</If>
|
See https://httpd.apache.org/docs/2.4/expr.html and https://httpd.apache.org/docs/2.4/handler.html |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 14 Dec '18 12:01 Post subject: |
|
|
I tested it a bit and what worked
Code: |
AllowOverride Options=None
AllowOverrideList RewriteEngine RewriteBase RewriteCond RewriteRule
|
|
|
Back to top |
|
|
|
|
|
|