Visit the domain name without www to download the file directly, and those with www can visit it.

problem description

download files directly by visiting the domain name without www. Those with www can visit
with www
without www

.

the environmental background of the problems and what methods you have tried

Ali CVM has been used by others for a while, but it has been reinitialized recently.
then the domain name was originally bound to the wordpress blog I built with the pagoda. After initialization, everything was cleaned up. However, visiting a domain name without www will directly download a file with the following contents:

<?php
/**
 * 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( dirname( __FILE__ ) . "/wp-blog-header.php" );

made some changes to nginx.conf according to the 301redirect method provided on Sifu, but had no effect:

server {
        listen 80;
        server_name rocwong.cn;
        return 301 http://www.rocwong.cn$request_uri;
    }

    server {
        listen       80;
        server_name www.rocwong.cn;

        -sharpcharset koi8-r;

        -sharpaccess_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        -sharperror_page  404              /404.html;

        -sharp redirect server error pages to the static page /50x.html
        -sharp
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        -sharp proxy the PHP scripts to Apache listening on 127.0.0.1:80
        -sharp
        -sharplocation ~ \.php$ {
        -sharp    proxy_pass   http://127.0.0.1;
        -sharp}

        -sharp pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.html;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }

        -sharp deny access to .htaccess files, if Apache"s document root
        -sharp concurs with nginx"s one
        -sharp
        location ~ /\.ht {
            deny  all;
        }
    }

add a configuration information chart for domain name resolution:

I hope you will spare no effort to teach me and provide me with some solutions and ideas. Thank you ~


Ah, the local cache problem can be accessed by another computer. 301has already taken effect. Awesome, give yourself a like!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be94d1-30cc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be94d1-30cc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?