Hello everyone..Could really use some htaccess assistance here! I've been working with the PHP link directory script and I have a php.ini file that needs to be accessed from the cgi-bin folder. Normally when I type in the url directly to the cgi-bin folder it gives me a "403 Permission Denied" as it should..However, when I have my .htaccess file in there..it always gives me a 500 Internal Server error instead. Can any .htaccess experts look over these Rewrites and see if they can find out why the cgi-bin folder gives a 500 Internal Server Error everytime I use this htaccess # For security reasons, Option followsymlinks cannot be overridden. #Options +FollowSymlinks ErrorDocument 404 /404.php Options +SymLinksIfOwnerMatch RewriteEngine On RewriteRule ^link-([0-9]+)\.html$ /w_work.php?id=$1 [L] RewriteRule ^([^/\.]+)-([0-9]+)\.html$ /w_work.php?name=$1&id=$2 [L] RewriteRule ^video/([^/]*)/$ /runvideo.php?id=$1 [L] RewriteRule ^video/([^/]*)$ /runvideo.php?id=$1 [L] RewriteRule ^article([^/\.]+)/([^/\.]+)-([^/]*)$ /runvideo.php?id=$1 [L] RewriteRule ^cat/([^-]*)-([^-]*)\.html$ /buscar.php?cat=$1&p=$2 [L] RewriteRule ^cat/([^/]*)\.html$ /buscar.php?cat=$1 [L] RewriteRule ^category/([^/]*)/([^/]*)\.html$ /pelicula.php?cat=$1&pelicula=$2 [L] RewriteRule ^thumbs/([^/]*)-([^/]*)\.html$ /thumbs.php?name=$1&id=$2 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ /w_newscat.php?cat=$1&subcat=$2&newscat=$3 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ /w_subcat.php?cat=$1&subcat=$2&newscat=$3 [L] RewriteRule ^([^/]*)/([^/]*)/$ /w_subcat.php?cat=$1&subcat=$2 [L] RewriteRule ^([^/\.]+)/?$ /w_cat.php?cat=$1 [L] RewriteRule ^([^/]*)/([^/]*)/?$ /w_cat.php?cat=$1&page=$2 [L] RewriteRule ^([^/]*)/([^/]*)?$ /w_cat.php?cat=$1&page=$2 [L] RewriteRule ^([^/]*)/([^/]*)$ /w_subcat.php?cat=$1&subcat=$2 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ /w_subcat.php?cat=$1&subcat=$2&page=$3 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /w_subcat.php?cat=$1&subcat=$2&page=$3 [L] RewriteRule ^view/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /w_wallpapers.php?cat=$1&sucat=$2&workid=$3&name=$4 [L] RewriteRule ^movie([0-9]+)/([a-zA-Z0-9-]+)$ our_work.php?id=$1 RewriteRule ^job/([0-9]+)/([a-zA-Z0-9-]+)$ w_video.php?workid=$1 RewriteRule ^video/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /motion_ar_detail.php?cat=$1&sucat=$2&workid=$3&name=$4 [L] RewriteRule ^index-([^/]*)\.html$ /index.php?page=$1 [L] RewriteRule ^thumbs/([^/]*)-([^/]*)\.html$ /thumbs.php?name=$1&id=$2 [L] RewriteRule ^links/([^/]*)/([^/]*)\.html$ /article.php?article_id=$1&name=$2 [L] RewriteRule ^index-page-([^/]*)\.html$ /index.php?pagina=$1 [L] RewriteRule ^pelicula_([^_]*)_([^_]*)\.html$ /buscar.php?by=$1&p=$2 [L] RewriteRule ^pelicula_([^_]*)_([^_]*)\.html$ /buscars.php?by=$1&p=$2 [L] # For security reasons, Option followsymlinks cannot be overridden. #Options +FollowSymlinks ErrorDocument 404 /404.php Options +SymLinksIfOwnerMatch RewriteEngine On Code (markup):
RewriteEngine is usually disabled by administrators within cgi-bin folder, which would give code 500 instead of 404 in the example above. Btw, repeating the same directives serves no purpose within htaccess.
So, you have put php.ini in cgi-bin folder, and uploaded your .htaccess file in your root html folder, if I understood you correctly, and now when you try to access some other cgi script in your cgi-bin folder the server returns 500 Internal Server Error. Right? Something was not clear here, so just to make sure: 1. Your php.ini file goes into cgi-bin folder, and your other scripts are going to other folders. Include path in your php script(s) pointing to your php.ini file should be directory path, and not url path. So it should be something like /home/domain/public_html/cgi-bin/php.ini (with cpanel should be exactly like that, with other panels path may be slightly different) 2. Your php.ini file should NOT be accessed via URL path, so if it is returning error if you try to open it via your browser, that's normal. I'm unable to reproduce the same error you are getting with your .htaccess file. Tried uploading it to both html folder, and cgi-bin folder, and all my cgi scripts keep working fine in cgi-bin folder. No errors there. So maybe it's not a .htaccess related problem... Post more info and maybe I can be more helpful. EDIT: If your server isn't configured with FollowSymlinks then this may cause 500 Internal Errors when trying to rewrite/redirect, so try uncommenting the line #Options +FollowSymlinks Code (markup): and leave it to be like this Options +FollowSymlinks Code (markup):