Ubuntu
我的域轉發到 www.www.www.domain.com
在
ubuntu server 16.04
我有一個 wordpress 網站,我想將它與域名連結。我在其中設置了 DNS 記錄,
vutlr
然後在我的伺服器中設置了虛擬主機但是,當我輸入 www.mydomain.com 時,我會轉發到 www.www.www.mydomain.com
為什麼會這樣?
虛擬主機是:
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin myemail@email.com ServerName mydomain.com ServerAlias www.mydomain.com DocumentRoot /var/www/html/mysite # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/mysite-error.log CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost>
我的
wp-config.php
<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'mydbsite'); /** MySQL database username */ define('DB_USER', 'sadadsadsadads'); /** MySQL database password */ define('DB_PASSWORD', 'asdadasdadasdassdadas'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8mb4'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 define('AUTH_KEY', ',<sssssssssssssssssssssssssssssssssssss'); define('SECURE_AUTH_KEY', 'sssssssssssssssssssssssssssssssssssss'); define('LOGGED_IN_KEY', 'Jssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss '); define('NONCE_KEY', ':sssssssssssssssssssssssssssssssssssssssssssssssssssssssss'); define('AUTH_SALT', 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssss'); define('SECURE_AUTH_SALT', 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssss'); define('LOGGED_IN_SALT', 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssss'); define('NONCE_SALT', 'sssssssssssssssssssssssssssssssssssssssssssssssssssssssss'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. define('WP_DEBUG', false); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
wordpess的文件夾裡面還有一個htcaccess文件
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /mysite/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /mysite/index.php [L] </IfModule> # END WordPress
還有來自 apache2 的錯誤日誌
由於可能的配置錯誤,請求超出了 10 個內部重定向的限制。使用 ‘LimitIn$
最後是vultr中DNS記錄中的設置
我已經浪費了 3 個多小時,試圖理解為什麼一個簡單的程序(我已經做了很多次)不起作用……
但是,解決方案非常簡單……
- 我在設置 - 正常中更改了 home 和 siteurl 以獲得域名。(感謝@Michael Hampton 的評論!)
- 然後我簡單地清除了瀏覽器中的記憶體,一切正常
…