PDA

View Full Version : .htaccess crap


Xallow
2007-01-03, 05:36 PM
I have this .htaccess file:

AddType application/x-httpd-php .php .html
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?pornpartyporn\.com [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^http://.*$
RewriteRule \.(jpe?g|gif|bmp|png|jpg|mpg|mpeg|wmv)$ http://www.pornlinkworld.com/freesites/hotlink.gif [L]

this line doesn't work:

AddType application/x-httpd-php .php .html

am I missing something?

RamCharger
2007-01-03, 05:43 PM
Just a guess, but you're probably causing an error when you're trying to override .html. That extension is probably already defined in the httpd.conf. Now the .php, on the other hand, might be up for grabs (depending on if it's defined in the httpd.conf or not). That's my immediate guess without really seeing or testing anything.

cd34
2007-01-03, 06:01 PM
doesn't work meaning what?

pages aren't parsed for php?
web pages all of the sudden pop up save-as boxes?
Error 500 - Internal Server Error pops up?

Xallow
2007-01-03, 06:04 PM
it still doesn't work if I remove the .html or if I remove the line entirely

Xallow
2007-01-03, 06:05 PM
doesn't work meaning what?

pages aren't parsed for php?
web pages all of the sudden pop up save-as boxes?
Error 500 - Internal Server Error pops up?


pages aren't parsed for php, it just shows the code

oast
2007-01-03, 06:17 PM
RamCharger:
Xallow is trying to add the html extension as a parsable(?) php script, hence the AddType declaration.

Xallow:
What webhost are you using? You shouldn't need to tell it to declare .php extensions as a PHP script, as that should be done in the httpd.conf when PHP is installed.

I have the following line in my .htaccess:
AddType application/x-httpd-php .html
It succesfully parses all .html folders in the folder (and subfolders) as php.

Try your .htaccess with the same line as mine (i.e. without the '.php')

Another thing to make sure of (I only mention it because I have made the error twice) is that you are uploading the .htaccess as an ASCII file type.

If all the above fails, I'd guess a configuration error at the host.

Xallow
2007-01-03, 06:21 PM
Another thing to make sure of (I only mention it because I have made the error twice) is that you are uploading the .htaccess as an ASCII file type.

How do You make it so it isn't a ASCII file type?

oast
2007-01-03, 06:37 PM
Another thing to make sure of (I only mention it because I have made the error twice) is that you are uploading the .htaccess as an ASCII file type.

How do You make it so it isn't a ASCII file type?By setting your FTP program to upload in binary mode

Xallow
2007-01-03, 07:05 PM
Ok, I tried it on another server with another host aswell and there it works like a charm, so I have sent the support guys a mail about the issue

Xallow
2007-01-04, 11:35 AM
well, the host doesn't support that function so i guess that wont be happening :(

oast
2007-01-04, 02:47 PM
well, the host doesn't support that function so i guess that wont be happening :(Time for a new host?

cd34
2007-01-04, 03:19 PM
RewriteEngine on
RewriteRule ^whatever.html$ whatever.php [QSA]

not that it a perfect solution, but, it is a workaround

Xallow
2007-01-04, 04:27 PM
RewriteEngine on
RewriteRule ^whatever.html$ whatever.php [QSA]

not that it a perfect solution, but, it is a workaround

How does that work? and the "whatever.html$ whatever.php" I am assuming should be the same page?

Also, I need to do this for a lot of pages, so I put them all in there like that?

cd34
2007-01-04, 04:39 PM
You might be able to use something like

RewriteRule ^(.*)\.html$ $1.php [QSA]

but then you would want to also make sure the destination file exists, etc.

I'm not sure why your hosting company won't turn it on for you -- the load generated is exactly the same.

If you can't parse .html pages with php, and you rename all your pages to php so that they can be parsed, there is no difference in terms of cpu horsepower required to serve your site.

The right solution is to just have them turn on php parsing for html pages. I'm not sure what your hosting company's resistance is to doing that.