Problems with mod_Rewrite

I originally had a .htaccess file:

php_value display_errors 1 php_value error_reporting 7 AddDefaultCharset utf-8 Options -Indexes <Files ~ ".*\.(info|tpl)$"> Order allow,deny Deny from all </Files> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L,QSA] 

Which caused 500 internal server errors, so I moved the first two lines to the php.ini file.

after that the error disappeared, but the redirection does not work, it just redirects to a blank page, the error log shows: the file was also not found, another log shows:

 PHP Warning: Unknown: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/:/usr/lib/php:/usr/local/lib/php:/tmp/:/usr/local/:/usr/bin) in Unknown on line 0 

I tried writing to RewriteLog, which again caused a 500 server error

Help a little? Thank you in advance

PS

 cPanel 11.24.5-STABLE (Build: 38506) Apache version 2.2.15 (Unix) MySQL version 5.0.85-community PHP version 5.2.9 Operating system Linux Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fcgid/2.3.5 
+4
source share
3 answers

It looks like PHP is trying to open the file with an empty path, so there is clearly some error in the PHP script that you are trying to access. Just check the access log at which URL you received this error, and try to fix the PHP script.

+1
source

As your reg-ex offers

 <Files ~ ".*\.(info|tpl)$"> 

you only allow access to .info and .tpl files. Am I something wrong here?

Edit: I made a comment when I realized an error on my side.

0
source

You should look into the apache log - there will be an error, and you will know what to fix after that.

0
source

Source: https://habr.com/ru/post/1306014/


All Articles