有道
登录到WordPress管理面板,转到设置>永久链接页面。
从这里,选择倒数第二选项,即:
http://domain.com/blogname/blog/sample-post/
另外,你可以创建一个重定向文件。这涉及到对wordpress的一些攻击。如果你不喜欢wordpress & php,我不会推荐这款软件。要做到这一点,首先:
公开赛在管理面板的设置>永久链接页面:
在列表中选择(自定义)的最后一个选项,并输入是这样的:
/redirect.php?p=%post_id%&a=%author%&c=%category%
您还需要更改以下两个可选的形式:
类别基地
/redirect.php?c=
标签基地
/redirect.php?t=
现在,让我们创建一个重定向PHP文件。将此放在/ yourblogname /博客/
<?php
$total=0;
$string = 'http://www.yourdomain.com/';
$fetch = '';
if (isset($_GET['p'])&&!is_null($_GET['p']))
{
$p = $_GET['p'];
if ($total ==0) {
$string.='?p='.$p;
} else {
$string.='&p='.$p;
}
$total++;
}
if (isset($_GET['t'])&&!is_null($_GET['t']))
{
$t = str_replace('/','',$_GET['t']);
if ($total ==0) {
$string.='?tag='.$t;
} else {
$string.='&tag='.$t;
}
$total++;
}
if (isset($_GET['a'])&&!is_null($_GET['a']))
{
$a = $_GET['a'];
if ($total ==0) {
$string.='?a='.$a;
} else {
$string.='&a='.$a;
}
$total++;
}
if (isset($_GET['s'])&&!is_null($_GET['s']))
{
$s = $_GET['s'];
if ($total ==0) {
$string.='?s='.$s;
} else {
$string.='&s='.$s;
}
$total++;
}
if (isset($_GET['c'])&&!is_null($_GET['c']))
{
$c = str_replace('/','',$_GET['c']);
if ($total ==0) {
$string.='?category_name='.$c;
} else {
$string.='&category_name='.$c;
}
$total++;
}
echo '<head><meta http-equiv="Refresh" content="0; URL='.$string.'">';
?>
<style>
html {
background:black;
color:white;
}
</style>
</head>
<body>
<div id=cont>
<p align=center><div style='font-size:72px;text-align:center;' ><?php echo "redirecting..."; ?></p></div>
</div>
</body>
我们还没有完成。我们需要调整我们重定向到现在的页面...(的index.php)
if (!isset($_GET['p'])) {
if (!isset($_GET['category_name']) && !isset($_GET['tag']) && !isset($_GET['s']) && !isset($_GET['search'])) {
include('newhome.php'); //frontpage with no special redirect
} else {
include('listabbrposts.php'); //a list of abbreviated posts for browsing
}
} else {
include('entry.php'); // a page with a single article
}
对于工作的例子,你可以看看我的页面,在这里我使用了这种方法:http://www.artfuladvection.com单击某个主题或标记从左侧看到重定向。
此资源是否有帮助? http://codex.wordpress.org/Using_Permalinks –