CGI execution error whenever I use htaccess file
Hello,
I have a Linux Server, running Centos 6.9, Apache 2.2.15, Postfix 2.6.6 and all those known common stuff. In order to set Error pages, Cache time for some types of files, as well as to adapt to Google requirements about having Domains with and without "www", I have at each Domain's root directory, an .htaccess file like this one you can see at the bottom. The problem: if under any Domain I have a Site which uses .cgi files, they all stop working and I receive messages like Page Not Found for any of them. In order to avoid this error I have to comment out all the Redirect lines, as you can see in the .htaccess below. So, please, I need help, because I need such an .htaccess file, but my CGI's have to keep working. Thanks a lot in advance. Mario Lima./ _______________________________________________________________ Code:
.htaccess file |
Quote:
Quote:
Code:
<VirtualHost *:80> |
Hi, bathory,
Thanks for your help. As a matter of fact, all of our Domains have <virtualhost> blocks with ServerName and ServerAlias, like this you mentioned. When I activate the .htaccess file, the error which occurs to any CGI we try to use is: PAGE NOT FOUND Regards. Mário./ |
Quote:
Unless you want to do something else, i.e. use mandatory www prefix. And please post the error from the apache logfile (in Centos is in /var/log/httpd/error_log), so we could see why you get the "PAGE NOT FOUND" error in the browser. |
Hi, bathory,
1) We use these lines with redirect because Google requires to do this way, so that Google does not consider with "www" and without "www" as being two different sites. 2) The error log messages are like this one: [Wed Mar 28 11:20:03 2018] [error] [client 201.6.232.101] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/html/multisites/www/cgi-multisites/ezformmx.cgi |
Quote:
If you have both names (with and without the www prefix) in the apache ServerName/ServerAlias directives of the appropriate VirtualHost and if of course those 2 names resolve by dns to your apache server, there is no need to use rewrites. Quote:
If apache thinks that FollowSymLinks is off, then most likely it does not read .htaccess. You can use either one of the following: Code:
AllowOverride Options |
Hi, bathory,
Based in your comments, I reviewed all the lines and I found two inconsistences. I altered and now it is all working, the .htaccess rules as well as the CGI scripts. The inconsistences were: Error: <IfModule mod_rewrite.c> aRewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule (.*) http://www.corretoresdeseguros.com.br/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule (.*) http://corretoresdeseguros.com.br/$1 [R=301,L] RewriteEngine on rewritecond %{http_host} ^corretoresdeseguros.com.br [nc] rewriterule ^(.*)$ http://www.corretoresdeseguros.com.br/$1 [r=301,nc] Options +FollowSymlinks </IfModule> Fixed: <IfModule mod_rewrite.c> RewriteEngine off RewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule ^/(.*) http://www.multisites.com.br/$1 RewriteCond %{HTTP_HOST} ^multisites\.com\.br$ [nc] RewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule (.*) http://multisites.com.br/$1 [R=301,L] rewritecond %{http_host} ^multisites.com.br [nc] rewriterule ^(.*)$ http://www.multisites.com.br/$1 [r=301,nc] Options +FollowSymlinks </IfModule> Thanks a lot. |
The other also fixed:
<IfModule mod_rewrite.c> RewriteEngine off RewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule ^/(.*) http://www.corretoresdeseguros.com.br/$1 RewriteCond %{HTTP_HOST} ^corretoresdeseguros\.com\.br$ [nc] RewriteCond %{HTTP_HOST} ^66\.226\.75\.86 RewriteRule (.*) http://corretoresdeseguros.com.br/$1 [R=301,L] rewritecond %{http_host} ^corretoresdeseguros.com.br [nc] rewriterule ^(.*)$ http://www.corretoresdeseguros.com.br/$1 [r=301,nc] Options +FollowSymlinks </IfModule> |
Quote:
Anyway, I'm glad you made it. Cheers |
Hi, bathory,
Sure. I thank you very much. Mário./ |
All times are GMT -5. The time now is 04:59 PM. |