Php 我的域名没有';行不通
如果我用地址“www.domain.com”进入我的域名,它会工作,但如果我像“domain.com”那样做,它不会工作,我会收到以下消息: 警告:无法修改标题信息-标题已由第1228行/home/eventtou/public_html/index.php中的/home/eventtou/public_html/wp includes/pluggable.php发送(输出开始于/home/eventtou/public_html/index.php:2) 这里是index.phpPhp 我的域名没有';行不通,php,wordpress,Php,Wordpress,如果我用地址“www.domain.com”进入我的域名,它会工作,但如果我像“domain.com”那样做,它不会工作,我会收到以下消息: 警告:无法修改标题信息-标题已由第1228行/home/eventtou/public_html/index.php中的/home/eventtou/public_html/wp includes/pluggable.php发送(输出开始于/home/eventtou/public_html/index.php:2) 这里是index.php <?p
<?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' );
我能做些什么来解决这个问题?提前谢谢你 如果运行apache,请将.htaccess文件放在网站的根目录中,或将下面的部分插入现有的.htaccess中
<IfModule mod_rewrite.c>
##-- Initialize and enable rewrite engine
##-- Documentation http://httpd.apache.org/docs/misc/rewriteguide.html
RewriteEngine On
##-- set the following line like e.g.: RewriteBase /myfolder/
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
</IfModule>
##--初始化并启用重写引擎
##--文件http://httpd.apache.org/docs/misc/rewriteguide.html
重新启动发动机
##--设置以下行,例如:RewriteBase/myfolder/
重写基/
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[L,R=301]
然后,对domain.tld的所有访问都会重定向到www.domain.tld
这并不能真正解决代码中的问题。但从搜索引擎优化的角度来看,防止重复内容是一个好主意。由于只访问www,这个问题不再重要。如果您的主机配置为回答
domain.com
请求,请尝试在页面顶部使用ob_start(),如果可能,请与您的ISP进行重复检查。它是一种子域,在签约主机服务时不会自动配置。如果主机为您所有,我认为这对httpd.conf文件很重要。
<IfModule mod_rewrite.c>
##-- Initialize and enable rewrite engine
##-- Documentation http://httpd.apache.org/docs/misc/rewriteguide.html
RewriteEngine On
##-- set the following line like e.g.: RewriteBase /myfolder/
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
</IfModule>