简体   繁体   English

HTACCESS 破坏了 PHP 代码和 Xampp 服务器

[英]HTACCESS broke PHP code and the Xampp server

After 450 hours of work my web-app doesn't work anymore, and I don't know how to solve it.工作 450 小时后,我的网络应用程序不再工作,我不知道如何解决。 Let me explain the situation:我来解释一下情况:

I was inserting my website into the server and playing around with htaccess.我正在将我的网站插入服务器并使用 htaccess。 I have changed many times the htaccess playing around with symlinks, rewriting url to go to redirect to https, etc.我已经多次更改 htaccess 使用符号链接、重写 url 以重定向到 https 等。

My website was logging in the user and now not anymore working for this function anymore:我的网站正在登录用户,现在不再使用此功能:

The Apache log is this one repeating the same name of the folder: Apache 日志是这样一个重复文件夹名称的日志:

[13/Oct/2017:21:44:59 +0200] "GET /developement/index.php/fold/fold/fold/fold/fold/fold/loginform.inc.php HTTP/1.1" 302 9358 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko" [13/Oct/2017:21:44:59 +0200] "GET /developement/index.php/fold/fold/fold/fold/fold/fold/loginform.inc.php HTTP/1.1" 302 9358 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko"

I have just changed the httpd.conf in Xampp inserting: AllowOverride All after I discovered it was on none我刚刚在 Xampp inserting: AllowOverride All 中更改了 httpd.conf 后我发现它没有

I don't really know what's going on: I think I have a problem in my php where I write the header: header("Location: ../invoice.php");我真的不知道发生了什么:我想我的 php 有问题,我写标题的地方: header("Location: ../invoice.php"); if the user is logging in.如果用户正在登录。

I have read that you can't have any echo in the php file before header if not is not working我读过你不能在头文件之前的 php 文件中有任何回声,如果不是的话

Further info:更多信息:

I have included a core.php file in all the files so I define some functionlike the below:我在所有文件中都包含了一个 core.php 文件,所以我定义了一些如下的函数:

<?
ob_start();//to use the header func to redirect to index.php after log in
session_name("test");//to hide session id def cookie name PHPSESSID=
session_start();//to save the global var user id after log in

//Errors On/off
if(strstr($_SERVER['SERVER_NAME'],"localhost")) {
    // Make sure we show all errors
    ini_set('display_errors', 1);
    ini_set('log_errors', 1);
    error_reporting(E_ALL);
    ini_set('html_errors', 'On');
    ini_set('display_startup_errors','On');
} else {
    //IMP: DA VERIFICARE SE FUNZIONA NEL SERVER!!!!!!!!!!!!!!!!!!!
    // We also want to suppress all warnings
    ini_set('display_errors', 0);
    error_reporting(0);
    ini_set('html_errors', 'Off');
    ini_set('display_startup_errors','Off');
}


//this to define links in my HTML (in header(Location: MIO./myfolder ) it does not work !!!)
//define http root
define("MINE",($_SERVER["SERVER_NAME"] == "localhost")? "http://localhost/developement/" : "https://www.mywebsite.it/");
//echo MINE;
?>

Content of .htaccess: .htaccess 的内容:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^mywebsite.it [OR]
RewriteCond %{HTTP_HOST} ^www.mywebsite.it [NC]
RewriteRule ^(.*)$ https://www.mywebsite.it/$1 [L,R=301]

Xampp Apache Access Log: Xampp Apache 访问日志:

::1 - - [15/Oct/2017:00:47:10 +0200] "POST /developement/elgin/loginform.inc.php HTTP/1.1" 200 10325 "http://localhost/developement/elgin/loginform.inc.php" "Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko"

Xampp Apache Error Log: Xampp Apache 错误日志:

Failed loading C:\xampp\php\ext\php_xdebug-2.5.4-7.1-vc14.dll
6] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

Just some php files had the BOM.只是一些 php 文件有 BOM。 Saved to BOM and re-saved to UTF-8 w no BOM保存到 BOM 并重新保存到 UTF-8 w no BOM

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM