Help - Search - Members - Calendar
Full Version: Overwrite HTACCESS
HTMLHelp Forums > Programming > Web Server Configuration
Dag
I have next lines in my htaccess in the web site root:
CODE

DirectoryIndex index index.html index.htm index.php
Options +MultiViews
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml .html .htm
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .html
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .htm
AddHandler cgi-script .php
AddType text/html .php


How to overwrite (kill, cancel, dismiss…) all above to have files .PHP to works without HTML in some DIR as WebSiteRoot/SomeDIR/do.php

Thanks in advance.
Darin McGrew
Can you explain what you mean by "works without HTML"?
Dag
Sorry for wild phrase Darin. I meant .PHP files to works with theirs own extension.

When I configured my server, I’ve asked hoster to avoid this:
SetHandler application/x-httpd-php
PHP not to be processed as application. They made htaccess as I posted and results were next:
Does not work (didn’t work):
http://laban.rs/_phpinfo.php

Works:
CODE

http://laban.rs/phpinfo.html
Content of phpinfo.html is:
<?php
        include $_SERVER["DOCUMENT_ROOT"]."/_phpinfo.php";
?>


So I thought that line
CODE

AddHandler cgi-script .php

were necessary and that is the key line which made the trick and that was ok with me.
But, when I try to play with wordpress, I’ve notice that nothing can work with my current setting.
http://laban.rs/wp/ (index.php is there) returned server error (php can’t be understood)

Host server admin wrote: "Just do comment the line
CODE

AddHandler cgi-script .php

and everything will work."
And he was perfectly right!!!
http://laban.rs/_phpinfo.php works now, /wp/ works too and *.html works.

1. Now I am not sure why I needed that line ever (few years ago) or what that exactly do?
2. Question remains unanswered: how to overwrite setting (any) from DIR one level up. Something as:
CODE

htaccess
DIR /A/ a = 24
DIR /A/S/ a = nothing (forget about a)


Christian J
QUOTE(Dag @ Jan 29 2017, 10:54 AM) *

1. Now I am not sure why I needed that line ever (few years ago) or what that exactly do?

Could it have something to do with running PHP as CGI?

QUOTE
2. Question remains unanswered: how to overwrite setting (any) from DIR one level up.

Would this work: https://httpd.apache.org/docs/2.4/mod/mod_m...l#removehandler unsure.gif

Dag
Hm... I've answered on this post already... but nothing here.

QUOTE(Christian J @ Jan 29 2017, 05:29 PM) *

QUOTE(Dag @ Jan 29 2017, 10:54 AM) *

1. Now I am not sure why I needed that line ever (few years ago) or what that exactly do?

Could it have something to do with running PHP as CGI?

It should of course but seems that I don't need it at all. My PHP coding is recognized. Ex-hoster guy told me that there are 2 possibilities: or PHP as application or as CGI. He was wrong.

QUOTE(Christian J @ Jan 29 2017, 05:30 PM) *

QUOTE
2. Question remains unanswered: how to overwrite setting (any) from DIR one level up.

Would this work: https://httpd.apache.org/docs/2.4/mod/mod_m...l#removehandler unsure.gif

Yep, that's it. Thanks Christian.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.