nginx included file not relaoding properly - php

I am using Linux azure box for PHP application. In my /etc/nginx/sites-available/default file I have added one file containing set of redirections. See code below,
include /home/site/nginx_redirections.txt;
And nginx_redirections.txt contains content like below(more than 500 redirections),
location /one {
return 301 https:example.com/oneredirect.html;
}
location /two {
return 301 https:example.com/tworedirect.html;
}
nginx_redirections.txt will change once in every month. But after changing new redirections are not reflecting. I am getting file not found error even after reloading nginx.
Can someone help me to resolve this issue? Thanks in advance

Related

Built-in server redirects my links to roots

I don't know why, but when I use the built-in server from the CLI, my relatives links doesn't work. For exemple I have a :
Continue reading
And the link leads to this error :
The requested resource /article.php was not found on this server.
Article.php and index.php are in /php directory.
I did not add this slash myself, how do I change this behaviour please?
I have tried to put ./article.php, /./article.php, it doesn't work.

xampp include doesn't work

Good morning at all! I have an issue that I don't understand.I've XAMPP
localhost files where include function doesn't work in one file, while
in other files works without problems.I'm running Chrome browser. I've
already tried to clear browser cache, but issue still exists. Why?
Include function works in this pages:
"index.php",
"blog.php",
"history.php"
Include function doesn't work only on this page:
contacts.php
The code is here:
<?php include('include/menu.php'); ?>
You need your absolute path to the include file correct by prefixing with $_SERVER['DOCUMENT_ROOT'];
In all your includes() do :
include($_SERVER['DOCUMENT_ROOT'].'/include/menu.php');
it would help to know two things: 1) where are the files located in? 2) what is the error message?
maybe the solution is simple since there is only the lack of the correct path:
include(__DIR__."/blog.php");
etc.
__DIR__ contains the path of the current script and is very useful to go up/down the directories based on it.
I've solved issue. I copied another existent page such as index.php with menu and footer correctly included, and I changed the body content and now it works.

Searching for the proper xampp/htdocs/index.php code

First of all I went through the already asked question related xampp/htdocs/index.php. (eg.: this, this and this and may more other) But still cant reach the proper xampp/index.php file (or other way xampp/index.html). I would like to ask ( those who can reach the the following screen(s), which is displayed at 6:30 in this youtube tutorial ).
Cause I can reach just the following schreen: which is displayed at 16:25 in this youtube tutorial.
the code what I see in my DEFAULT index.php is this:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/dashboard/');
exit;
?>
Something is wrong with the XAMPP installation :-(
and I tried to modify this line: header('Location: '.$uri.'/dashboard/'); to header('Location: '.$uri.'/**xampp**/');. (in the htdocs/xampp folder I tried to search for the page that is displayed in the tutorial that I linked first).
So ones again I want to reach somehow that screen that is displayed in the first tutorial, I went through all the folders in xampp folder but ther is no any that is redirecting to the proper searched site (most probably the newer versions does not consist this feature/ consist this features some other way).
Anyway I hope someone could help!
If you want to reach the first screen you mentioned
XAMPP Panel & have installed xampp, then just enter in your browser: localhost/xampp
If you want it to come up whenever you type "localhost" in browser then change the index.php /dashboard/ to /xampp/ and it will show in browser if you only type "localhost" without any directory extension.
If you want to show a list of all your xampp/htdocs in your browser window instead of defining a single directory (i.e. like /dashboard) then just rename your index.php & index.htm files (or delete them) then when you type "localhost" or "http://localhost" you will be presented with all the index folders & files from your xampp/htdocs folder in your browser window.. select the local website folder and it will open the corresponding local index file...
Hope that is what you were looking for?
I find the answer for my question. Probably it might be useful for the others that might face the same "problem". HERE IS THE LINK TO THE RELIABLE SOURCE REGARDING IT.
in short: there is no more /xampp/index.php, or as I mentioned "orange/yellow xampp page" (that I and some of us are searching for.), you have to find everything on the phpmyadmin!
Have a Nice day!!! ;)

PHP file handling and third level domains

I've a subdomain like software.domain.com that is a redirect to domain.com/software/ through cPanel redirect.
I'm creating an upload system that send all the files in a sibling folder, like domain.com/files/, no problem uploading with some tricks but when it's time to delete that file, that specific script cannot find it...
Returning the $_POST variable send to the script, the path is right, as /files/path/to/file, it refers to the public_html root as it has to be!
The script is invoked using an ajax call, it could be it? Maybe some path translation...
Thanks a lot!
If you are saying your AJAX can't find it from the subdomain, or anywhere else, you need to use the full domain path, WITHOUT the subdomain.
var url = "http://domain.com/files/path/to/file";
If you're saying your PHP can't find it, you can do something like this to ge the absolute path. From a file in the root of your SUBDOMAIN...
$url = realpath(dirname(dirname(__FILE__)))."/files/path/to/file.php";

PHP: include function is blocked

My PHP files are not able to call the include function anymore. I suppose my hosting changed php settings. Is there any workaround to this problem? Can I enable the include function in php.ini/.htaccess files? How? My host is using PHP version 4.4.9.
EDIT - All the files that I am trying to include are local files and not files on another server. The include functions were working fine until a few days back. They have suddenly stopped working.
i think is permission problem,
do you see error in error log file ,
or see error in the screen ?
Maybe your host changed the path to your www.
Are you using relative or absolute paths in your include()?
This looks and feels wrong, but could this work?
function includeFile($path) {
if (!file_exists($path)) {
return false;
}
$contents = file_get_contents($path);
eval($contents); // ewww
return true;
}

Categories