Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess Issue

Status
Not open for further replies.

PCHomepage

Programmer
Feb 24, 2009
609
US
Using the same .htaccess that I use for most of my sites, a new one seems to be having a problem. It is wanting to download the PHP rather than to present it which is odd because without the .htaccess, the site works fine. The other sites are all on the same server and this .htaccess works fine for them so what did I miss?

Code:
Options -Indexes
DirectoryIndex index.php

AddDefaultCharset UTF-8

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-javascript .js
AddType application/x-shockwave-flash .swf

<Files .htaccess,mysql.php,DBconnection.php,config.php>
   Order Allow,Deny
   Deny from all
</Files>
 
The different behaviour might indicate a change from apache 2.2 to 2.4

Quoted from
{quote]
2.2 configuration:
Order deny,allow
Deny from all

2.4 configuration:
Require all denied
[/quote]

While you say all sites are on the same server, is that really true? Same IP might still just be the gateway to several servers/hosts or virtual machines running your domains and different apache version applied. For a new site you may get a newer apache than the apache still working for your other sites.

Worth a try, isn't it?

Bye, Olaf.
 
Good thought but it's definately the same physical server. In fact, the site having the problem is a subdomain of another site but other subdomains use the same .htaccess and they are working. Same Apache, same PHP etc.
 
Do you find any indication what is going on in the apache error log?

Im not sure: Can .htaccess be overriden by eg a <Directory> definition in httpd.conf?

Bye, Olaf.

 
In fact, the site having the problem is a subdomain of another site but other subdomains use the same .htaccess and they are working

What about differences in the root .htaccess of the site(s)? [assuming sub-domains are off the site documentroot]

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
The only difference between the domain's and subdomains' .htaccess is that each has different Files being blocked due to the different requirements of each. No, I see no related errors in the Apache error log.
 
Apparently it was the

Code:
AddType application/x-httpd-php .php

that was causing the problem! With it remarked out, the site loads properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top