.htaccess php parsing error

Hi, i recently purchased a arcade site script from x10media. For some reason when I installed the script and go to my site’s homepage (or any other page) i get a popup box asking me to download a file, which ends up being my index.php file.

When i remove the .htaccess file from the site directory, everything runs fine, however im not really sure what the .htaccess file is doing so i’ve put it here, so maybe someone can help me interpret it since im no pro with apache.

AddHandler server-parsed .php
<Files ~ “[1]+$”>
SetHandler application/x-httpd-php
</Files>
AddHandler application/x-httpd-php .php

Right now i cant get any support from the guys at x10media, which is why im asking here. I know they hosts their site scripts predominately on Godaddy which only offer windows hosting? and i’m with hostgator which uses Apache and cpanel. If anyone can offer an alternative code or help me rewrite the .htaccess so it does it is supposed to do without error, that would be great :).


  1. ^\. ↩︎

Gee, Stomme poes, why don’t you tell us what you really think?

:lol: :lol: :lol:

Spot on, though! I couldn’t have made a better rant about silly things myself! :tup:

edhan, extensionless URIs are one thing but tiny urls are designed to HIDE the real link and, as such, are widely considered dangerous (you never know where you’ll end up - that’s why they’re FORBIDDEN at SitePoint). They may be … er, tiny, but they are not something which is conducive to remembering and, as a webmaster, I want to make my links memorable so visitors can easily return.

Regards,

DK

I guess you are right. It will not really for SEO. But I think if they said to make it looks neater will sound better.

I love the tiny URL. It really helps those long URL looks neater.

apparently the code in the .htaccess is for SEO purposes:

Ah, SEO myths… it’s sad that companies make things unnecessarily complicated “for SEO”. Anyone who claims the Googles et al cannot deal with .php, .html, .aspx, etc file extension on URLs should quit their snake-oil jobs and take up basket weaving. Search engines know what those files are because your server is properly serving those files as (predominantly) text/html MIME type, meaning the search engine is getting pretty much exactly what you see if you look at your page in a text editor such as Lynx. Do they prefer extensionless URLs? No. They don’t care either way.

To make this working proeprly, your .htaccess file must be configured properly to parse file with no extension as php file.

Bah. Your real file ends with .php. mod_rewrite can take a URL without .php on the end and rewrite your user over to the “real” url, who does end with .php. Nobody else has to parse anything, no unknown files types abound.

Though I suppose I can sympathise with a company struggling to deal with users running something weird and bizaar-O like IIS : ) But the “SEO” stuff makes my blood boil. If you’re removing extensions, it’s because you think .php is ugly (I agree), or because you don’t want it to be soooo obvious what back-end language you’re running (those writing in Ruby, Python or Perl may understand embarrassment here : ).

Seems like they are using php5. Thanks for sharing the solution as we might need it for ourselves in future.

Actually, my thoughts are for both. The one using TinyURL as well as foo.com/quux instead of the long URL.

I seldom use TinyURL except occasionally for Clickbank affiliate’s link.

I thought edhan really was talking about the shorter-as-in-prettier urls, not the tinyURL service.

foo.com/main.pl?page=foo&id=bar&merk=baz&style=quux

I can see someone calling this a tiny (shorter) url:
foo.com/foo/bar/baz/quux

I kinda agree with you that such links maybe dangerous as you wouldn’t know where it goes. But then in business term, having shorter url seems to be good though. I tend to choose domain name to be short and simply to remember, same goes with the extension.

r878,

First, WELCOME to SitePoint’s Apache forum.

The problem you’ve described is one where your server does NOT know how to handle the request for the file type requested, i.e., it doesn’t know what to do with a request for a php script.

Because my test server uses:

AddType application/x-httpd-php .php

in its httpd.conf, I’d suggest that’s all you need in your .htaccess (IF anything - php is a common feature of Apache hosts, i.e., REMOVE [comment out] all the nonsense you have and that should work; if not, add the AddType line).

Regards,

DK

thanks for the reply DK :), I’ve chosen to remove everything in that .htaccess file and everything seems to be working fine. I’ll just leave it at that for now until i get a response back from x10media support to do otherwise.

I think you httpd.conf already has the info since when you remove the .htaccess, it works for you. I maybe wrong but likely to be the case as I had encountered that in the past before.

I was finally given access to the support forums at x10media, apparently the code in the .htaccess is for SEO purposes:

[I]SEO mode on Arcadwy is made using php file without extension. Ie.: game, category.

To make this working proeprly, your .htaccess file must be configured properly to parse file with no extention as php file.

since server configuration differ from a place to another, there is no one fit all solution.

We provide a default version of .htaccess with the script. Usually, that will work for most installation. For others, its needs more tweaking.
[/I]

this revised code they provide seems to work on my server:

<Files ~ “[1]+$”>
SetHandler application/x-httpd-php5
</Files>


  1. ^\. ↩︎