字preSS失踪博客永久链接 [英] Wordpress missing blog permalink
问题描述
设置我的字preSS网站,进口的所有博客文章,并于上个月提交了Sitemap到谷歌。
I set up my Wordpress website, imported all blog post and submitted my sitemap to Google last month.
我意识到我的博客文章出现,如:www.domain.com/blog-post-name< - 不带/博客/目录。我可以通过更改字preSS固定链接加入博客目录中,但后来当有人往旧的博客网址,他们得到一个404错误。
I realized that my blog posts appear like: www.domain.com/blog-post-name <- without the /blog/ directory. I can add the blog directory by changing the Wordpress permalinks, but then when someone goes to the old blog URL, they get a 404 error.
是否有可能直接谁去www.domain.com/blog-post-name~~V到www.domain.com/blog/blog-post-name~~V用户
Is it possible to direct users who go to www.domain.com/blog-post-name to www.domain.com/blog/blog-post-name
感谢
推荐答案
这应该为你工作(修改 www.domain.com
到您的域):
This should work for you (changing the www.domain.com
to your domain) :
Options -Indexes +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/blog/
# Don't apply to URLs that go to existing files or folders
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /blog
RewriteRule ^(.*)$ http://www.domain.com/blog/$1 [L,R=301]
编辑: 这将改写特定网址:
This will rewrite specific urls:
RewriteEngine On
RewriteRule ^blog-post1$ http://www.example.com/blog/blog-post1 [R=301,L]
RewriteRule ^blog-post2$ http://www.example.com/blog/blog-post2 [R=301,L]
这篇关于字preSS失踪博客永久链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!