wordpress固定链接只能设为默认,设成其它的都会出现Object not found!
这个是.htaccess文件里面的内容#BEGINWordPress<IfModulemod_rewrite.c>RewriteEngineOnRewriteBase/R...
这个是.htaccess文件里面的内容
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我wordpress的版本是中文3.2.1 展开
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我wordpress的版本是中文3.2.1 展开
3个回答
展开全部
windows主机自定义链接必须要加一个 /index.php/ 在路径中,否则就会找不到出错,是系统的问题。
最简单的解决办法:自定义服务器404页面,很多主机都提供了这一功能。WP3.2.1代码可用如下,请加入PHP标记后设置为服务器自定义404页。(此段代码亦能解决定义404后WP翻页不能的问题,请自行将所有标点改成英文标点。)
// This is the default file for the site. Usually index.php
$default = ‘index.php’;
// The name of this file.
// Set this value for the URL in Custom Error Properties of your website in IIS.
// Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
// 404 & 404;2 & 404;3 > URL (Requires a ‘/’ prefix in IIS).
$thisfile = ’404-handler.php’;
$_SERVER['ORIG_PATH_TRANSLATED'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_TRANSLATED']);
$_SERVER['SCRIPT_FILENAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_FILENAME']);
$_SERVER['ORIG_PATH_INFO'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_INFO']);
$_SERVER['SCRIPT_NAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace($thisfile, $default, $_SERVER['PHP_SELF']);
$_SERVER['PATH_INFO'] = false;
$qs =& $_SERVER['QUERY_STRING'];
$ru =& $_SERVER['REQUEST_URI'];
$pos = strrpos($qs, ‘://’);
$pos = strpos($qs, ‘/’, $pos + 4);
$_SERVER['URL'] = $ru = substr($qs, $pos);
$qs = trim(stristr($ru, ‘?’), ‘?’);
// Required for WordPress 2.8+
$_SERVER['HTTP_X_ORIGINAL_URL'] = $ru;
// Fix GET vars
foreach ( $_GET as $var => $val ) {
if ( substr($var, 0, 3) == ’404′) {
if ( strstr($var, ‘?’) ) {
$newvar = substr($var, strpos($var, ‘?’) + 1);
$_GET[$newvar] = $val;
}
unset($_GET[$var]);
}
break;
}
include($default);
如果你还需要去掉链接中的 /category/ ,请查看参考资料。
最简单的解决办法:自定义服务器404页面,很多主机都提供了这一功能。WP3.2.1代码可用如下,请加入PHP标记后设置为服务器自定义404页。(此段代码亦能解决定义404后WP翻页不能的问题,请自行将所有标点改成英文标点。)
// This is the default file for the site. Usually index.php
$default = ‘index.php’;
// The name of this file.
// Set this value for the URL in Custom Error Properties of your website in IIS.
// Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
// 404 & 404;2 & 404;3 > URL (Requires a ‘/’ prefix in IIS).
$thisfile = ’404-handler.php’;
$_SERVER['ORIG_PATH_TRANSLATED'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_TRANSLATED']);
$_SERVER['SCRIPT_FILENAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_FILENAME']);
$_SERVER['ORIG_PATH_INFO'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_INFO']);
$_SERVER['SCRIPT_NAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace($thisfile, $default, $_SERVER['PHP_SELF']);
$_SERVER['PATH_INFO'] = false;
$qs =& $_SERVER['QUERY_STRING'];
$ru =& $_SERVER['REQUEST_URI'];
$pos = strrpos($qs, ‘://’);
$pos = strpos($qs, ‘/’, $pos + 4);
$_SERVER['URL'] = $ru = substr($qs, $pos);
$qs = trim(stristr($ru, ‘?’), ‘?’);
// Required for WordPress 2.8+
$_SERVER['HTTP_X_ORIGINAL_URL'] = $ru;
// Fix GET vars
foreach ( $_GET as $var => $val ) {
if ( substr($var, 0, 3) == ’404′) {
if ( strstr($var, ‘?’) ) {
$newvar = substr($var, strpos($var, ‘?’) + 1);
$_GET[$newvar] = $val;
}
unset($_GET[$var]);
}
break;
}
include($default);
如果你还需要去掉链接中的 /category/ ,请查看参考资料。
参考资料: http://www.libertystudio.net/2011-01/wordpress-abandon-category-in-permalink.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
配置apache 中的http.conf 把所有的AllowOverride 的属性都改成all
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是因为你没有.htaccess吧?这段代码是在.htaccess文件里,还是在改固定连接时出现的?如果是后者,就把代码生成.htaccess文件就行了.前者,我就无能为力了
更多追问追答
追问
上面的代码是改固定链接自动生成.htaccess里面的。。而且这个文件是在根目录下的。。。操作系统是XP的。
追答
windows吧,这个不懂了.用wordpress最好还是找个好点的linux主机,免得麻烦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询