10/10/2018, 00:24

lỗi index.php ai giúp với

mới tập làm web, đc. cái http://mistarg.summerhost.info, nhưng mỗi lần vào http://mistarg.summerhost.info nó ko tự động redirect tới http://mistarg.summerhost.info/index.php được. ai giúp với.
9xvn viết 02:34 ngày 10/10/2018
Tạo 1 file index.html ở thư mục root rồi thêm code này vào


<meta http-equiv="Refresh" Content="0; url=http://mistarg.summerhost.info/index.php ">
Shellingfox viết 02:26 ngày 10/10/2018
Bạn coi còn file index.html trong đó không? Mặc định thì file index.html được ưu tiên hơn. Nếu có cả 2 file index.html và index.php giờ muốn chạy index.php thì xoá file index.html đi
mistarg viết 02:27 ngày 10/10/2018
Được gửi bởi 9xvn
Tạo 1 file index.html ở thư mục root rồi thêm code này vào
làm đúng như vậy cũng không được.

và chỉ có duy nhất 1 file index thôi.

---------------------------------------
mới test tài khoản khác, thì nó lại tự động chuyển tới news.php, chẳng hiểu thế nào. http://mistarg1.summerhost.info
cái nick đó viết 02:32 ngày 10/10/2018
yêu cầu hơi bị kì quái

thêm đoạn này vào trên cùng index.php
PHP Code:
if (strpos($_SERVER***91;'REQUEST_URI'***93;, '/index.php') < 0) {
    
header('Location: /index.php');
    exit();

mistarg viết 02:29 ngày 10/10/2018
Được gửi bởi cái nick đó
yêu cầu hơi bị kì quái

thêm đoạn này vào trên cùng index.php
PHP Code:
if (strpos($_SERVER***91;'REQUEST_URI'***93;, '/index.php') < 0) {
    
header('Location: /index.php');
    exit();

em làm đúng như hướng dẫn mà ko được.
cái nick đó viết 02:38 ngày 10/10/2018
nhớ nhầm hàm này rồi, phải viết như vầy mới được

PHP Code:
if (false === strpos($_SERVER***91;'REQUEST_URI'***93;, '/index.php')) {
    
header('Location: /index.php');
    exit();

mistarg viết 02:32 ngày 10/10/2018
file index.php đã sửa như sau nhưng vẫn thế

Code:
<?php
if (false === strpos($_SERVER['REQUEST_URI'], '/index.php')) {
    header('Location: /index.php');
    exit();
}  
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>
SweetLoveFC viết 02:31 ngày 10/10/2018
Code:
if (false === strpos($_SERVER['REQUEST_URL'], '/index.php')) {
    header('Location: /index.php');
    exit();
}
Wrong URI --> URL
Bài liên quan
0