Hefei SEO has also played with Dedecms before and has never been exposed to WordPress, so it took nearly a week to call this site. I used dedecms to call this site before, but there are many functions that are very troublesome to implement, such as monthly archiving, random articles and other blog features, which require secondary development, so I switched to WordPress out of desperation.
Before contacting them, I had heard about setting up blog programs such as z-blog and wordpress, but I had never put them into practice. I spent nearly an hour watching the video tutorial, got a general understanding of wordpress, and then put it into practice. After all, newbies sometimes don’t even know the corresponding plug-ins for a certain function, so they can only explore slowly. In the process, I finally learned a lot of knowledge. I believe everyone can see the big aspects by searching online. I would like to share some tips I encountered here.
1. Create a template page. Different from dedecms, wordpress needs to add a piece of code to create a new template page.
<?php
/*
Template Name: template name
*/
?>
2. Page jump. How to achieve page jump? Create a template and add code.
<?php
/*
Template Name: Redirect
*/
if (have_posts())
{
the_post();
$pattern = '@(https?://([-w.]+)+(:d+)?(/([w/_.]*(?S+)?)?) ?)@' ;
preg_match($pattern, get_the_excerpt(), $matches);
if ($matches[0]) header('Location:'.$matches[0]);
else echo 'Enter a URL into your page body text.';
}
?>
After saving the template to the theme directory, you can fill in the target address to be redirected in the html state of the page. like
Implement page jump
3. Remove index.php. At that time, the WordPress program that was built locally, when uploading it to the server for access, could not always remove index.php, which was frustrating. I finally figured it out and will share the solution with everyone. If the server is using Windows2003+IIS, index.php will always appear when we fix the permanent link.
(1) Create a php document, set the encoding to UTF-8, write the following code and save 404.php and upload it to the website root directory.
<?php
header("HTTP/1.1 200 OK");
$ori_qs = $_SERVER['QUERY_STRING'];
$pattern = '/[^;]+;[^:]+://[^/]+(/[^?]*)(?:?(.*))?/i';
preg_match($pattern, $ori_qs, $matches);
$_SERVER['PATH_INFO'] = $matches[1] . '?' . $matches[2];
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
$query_args = explode('&', $matches[2]);
unset($_GET);
foreach ($query_args as $arg)
{
$the_arg = explode('=', $arg);
$_GET[$the_arg[0]] = $the_arg[1];
}
include('index.php');
?>
(2) Enter the server and find the setting 404 custom error pointing to 404.php. The premise is that your server has this function. If not, there are other publications on the Internet, such as using the cos-html-cache plug-in. I have not tried it and I am not sure.
Customize 404 modification to remove index.php
(3) Enter the WordPress management background, set a permanent link, and install the format settings you want. It is the same as local one.
4. The power of wordpress is definitely inseparable from powerful plug-ins. From the perspective of SEO, here are a few recommended for you. Haha, this is just to let novices know that there is this plug-in. Don’t be like the pioneers before and explore it bit by bit. You can search for the specific usage method by yourself. You will know it.
(1) Platinum SEO Pack: Mainly for search engine optimization pages and article titles, automatically generate SEO-related meta tags.
(2) WP No Category Base: By default, the fixed link format of WordPress category is http://www.***.org/category/blog/ . Using this plug-in, you don’t need to modify the WordPress core program and it will not be damaged. For other non-related links, the "category" field in the category link can be automatically removed and turned into http://www.***.org/blog/ .
(3) aidu Sitemap Generator / Google xml Sitemaps: These two are good website map generation plug-ins, which can generate .html and .xml formats.
(4) WP Kit CN: I previously used the Chinese WordPress toolbox, but it was not ideal. Later, I used an improved version, which is wp kit cn. Random article recommendations can make your website change and make spiders think you are changing.
(5) wp slug translate: After we added an article, when you fixed the link as the article name, the url with the Chinese name was garbled. Use this plug-in to translate it into English. But I considered uninstalling it. When I fixed the link, I changed it to /%post_id%.html.
These are the plug-ins I use on my site and are closely related to SEO optimization.
5. Another recommended plug-in, because it has nothing to do with SEO optimization or even violates SEO optimization, but I think it is very cool, so I will mention it here. WP Cumulus: This plug-in can achieve 3D effect cloud tags, but its support for Chinese is a bit poor.
Cloud labels with 3D effect
That’s it for today. The above is a bit of practical knowledge accumulated in the process of building a WordPress website as a newbie to record. Friends who like this theme can visit Hefei SEO to open a blog. If there are problems during the construction process, you can also communicate with the forward. In addition, I will share the knowledge points encountered and solved in using Dedecms to build this theme style next time. Accumulating a small step every day will lead to a big step towards success. This article is original by the Hefei SEO webmaster. Please indicate the source for reprinting: www.anhuiseo.org Thank you!
Thanks to qhpf298 for his contribution