Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't access php file with .htaccess RewriteEngine

Discussion in 'General Discussion' started by trdunya, Jun 23, 2017.

  1. trdunya

    trdunya Registered

    Joined:
    Jun 23, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    Hello,

    I changed my host a week ago. And my .htaccess file didn't worked after that. My problem is; i can't access in .htaccess php file parent directory with RewriteEngine because of it's subdomain or addon domain directory. There is no problem when i created and accessing any php file in normal directory. But i can't access outside directory in htaccess file of the addon or subdomain directory. My old server has "Apache 2.2". maybe the problem because of "Apache 2.4" or modules. If i can find to the solution i can change everything.

    I have no complex .htaccess rules. Just that:

    the directory = demo.domain.tld / domain.tld/demo

    /home/user/public_html/demo/.htaccess -> /home/user/public_html/index.php

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule . ../index.php

    Also this is working with same .htaccess file exactly;

    /home/user/public_html/normaldir/.htaccess -> /home/user/public_html/index.php

    But it's giving 500 Internal Server Error on browser. I changed Apache loglevel to error and there is "authorization result: granted no directives" error when i switched litespeed to apache and tail -f error_log.

    This problem only being in .htaccess file... I can accessing with in php inlcude function any another php file.

    I trying to solve this problem since a week ago and i tired. I really need help.

    By the way my English not so good. Hopefully i could explain what i have problem. And i couldn't find solution of the problem in this forum. So that's why i opened this subject with my poor English.

    Best Regards,
    Mustafa

    [VDS]
    cPanel & WHM 64.0 (build 24)
    Virtualization: vmware
    Operating System: CentOS Linux 7.3 (Core)
    CPE OS Name: cpe:/o:centos:centos:7
    Kernel: Linux 3.10.0-514.21.1.el7.x86_64
    Architecture: x86-64
    Litespeed Web Server Enterprise 5.1.16
    EasyApache Apache 2.4, PHP 5.5, PHP 5.6, PHP 7.0, and PHP 7.1

    [Apache 2.4]:
    config, config-runtime, mod_bwlimited, mod_cache, mod_cache_disk, mod_cgi, mod_dbd, mod_deflate, mod_expires, mod_file_cache, mod_headers, mod_imagemap, mod_mpm_prefork, mod_proxy, mod_proxy_fcgi, mod_proxy_http, mod_security2, mod_ssl, mod_substitute, mod_suexec, mod_suphp, mod_unique_id, tools

    [Others]:
    apr, apr-util, cpanel-tools, documentroot, libcurl, libmcrypt, libtidy, modsec-sdbm-util, php-cli, php-cli-lsphp, profiles-cpanel
     
  2. Eminds

    Eminds Well-Known Member

    Joined:
    Nov 10, 2016
    Messages:
    211
    Likes Received:
    13
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    did you checked the apache error logs ? have a look at logs and that may give you a better idea of whats happening .

    check the error logs at /usr/local/apache/logs/error_log from ssh
     
  3. trdunya

    trdunya Registered

    Joined:
    Jun 23, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    Yes. I checked but there is no make sense log.

    Active PHP Handler on MultiPHP Manager: php7.0 -> cgi
    Php-fpm on/off same...

    ------

    When active Litespeed:

    [Browser]: 500 Internal Server Error

    [Error log]:

    2017-06-24 13:34:40.598 [ERROR] [xxx.xxx.xx.xxx:33720] Maximum number of redirect reached.
    2017-06-24 13:34:40.598 [ERROR] [xxx.xxx.xx.xxx:33720] Maximum number of redirect reached.

    When active Apache(without litespeed):

    [Browser]: 400 Bad Request

    [Error log]:

    [Sat Jun 24 20:41:12.618429 2017] [proxy:debug] [pid 9960] proxy_util.c(2171): AH00943: FCGI: has released connection for (*)
    [Sat Jun 24 20:41:14.829948 2017] [authz_core:debug] [pid 10002] mod_authz_core.c(835): [client xxx.xxx.xxx.xxx:26172] AH01628: authorization result: granted (no directives)
    [Sat Jun 24 20:41:14.830060 2017] [authz_core:debug] [pid 10002] mod_authz_core.c(835): [client xxx.xxx.xxx.xxx:26172] AH01628: authorization result: granted (no directives)
    [Sat Jun 24 20:41:14.830103 2017] [core:error] [pid 10002] [client xxx.xxx.xxx.xxx:26172] AH00126: Invalid URI in request GET / HTTP/1.1
    [Sat Jun 24 20:41:14.830151 2017] [authz_core:debug] [pid 10002] mod_authz_core.c(835): [client xxx.xxx.xxx.xxx:26172] AH01628: authorization result: granted (no directives)
    [Sat Jun 24 20:41:14.830242 2017] [core:error] [pid 10002] [client xxx.xxx.xxx.xxx:26172] AH00126: Invalid URI in request GET / HTTP/1.1
     
  4. trdunya

    trdunya Registered

    Joined:
    Jun 23, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Turkey
    cPanel Access Level:
    Root Administrator
    I resolve this problem with CPanel support team's help.

    This problem about Apache 2.4 security reasons.

    And new security rules of 2.4 doesn't permit in .htaccess include file with RewriteRule out of DocumentRoot.

    But as there are Alias, AliasMatch new helper rules for solve of this problem.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm glad to see you were able to address the issue. Thank you for updating us with the outcome.
     
Loading...

Share This Page