How do I get modx to ignore my cgi-bin? I’m getting an error page generated by modx when I try to access a script!
(I’m using Apache on Linux server)
Mostly harmless.
-
☆ A M B ☆
- 24,524 Posts
How are you accessing the script? I’m using a perl script (Dada mail) in a module and it works fine.
-
☆ A M B ☆
- 24,524 Posts
Try copying the .htaccess file that’s in the /manager folder to your /cgi-bin folder.
thank you - yes of course!
only problem now is when I password protect that same directory with additional code below the problem reoccurs.
RewriteEngine Off
AuthType Basic
AuthName "••PRIVATE••"
AuthUserFile "/home/xxxxx/.htpasswds/public_html/cgi-bin/private/passwd"
require valid-user
Mostly harmless.
-
☆ A M B ☆
- 24,524 Posts
As to that, I have no ideas.
OK, there’s a known problem with mod_rewrite and .htpasswd, so the closest solution is the last two lines here:
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#Exclude directory from Mod_Rewrite
RewriteCond %{REQUEST_URI} !^/directory(/.*)?$ [NC]
RewriteRule .* rewrite?%{REQUEST_URI} [L]
...where ’directory’ is the name of the directory needing to be ignored by mod_rewrite - my cgi-bin in this instance.
Mostly harmless.
After doing some testing I wouldn’t recommend putting the above code into the root level .htaccess file, as it does some weird sh*t to the web site. Instead, I put the code below into an .htaccess file in the cgi-bin. Works a treat now - doesn’t clash with .htpasswd.
#Exclude directory from Mod_Rewrite
RewriteCond %{REQUEST_URI} !^/directory(/.*)?$ [NC]
RewriteRule .* rewrite?%{REQUEST_URI} [L]
Mostly harmless.