字preSS失踪博客永久链接链接、博客、preSS

由网友(除了死亡所有离开都是背叛)分享简介:设置我的字preSS网站,进口的所有博客文章,并于上个月提交了Sitemap到谷歌。I set up my Wordpress website, imported all blog post and submitted my sitemap to Google last month.我意识到我的博客文章出现,如:w...

设置我的字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]
阅读全文

相关推荐

最新文章