.htaccess htaccess静态url重写

.htaccess htaccess静态url重写,.htaccess,url,mod-rewrite,url-rewriting,.htaccess,Url,Mod Rewrite,Url Rewriting,我在wordpress博客上工作,its的url模式是这样的localhost/blog/2012/10/12/sample post/ 现在我已经将url模式更新为localhost/blog/sample post/ 现在,如果有人进入第一个URL模式,我需要重定向到第二个URL模式,因为我已经向几篇文章提交了带有第一个模式的URL i、 e,localhost/blog/2012/10/12/sample post/应重定向到localhost/blog/sample post/ 有人能帮

我在wordpress博客上工作,its的url模式是这样的localhost/blog/2012/10/12/sample post/

现在我已经将url模式更新为localhost/blog/sample post/

现在,如果有人进入第一个URL模式,我需要重定向到第二个URL模式,因为我已经向几篇文章提交了带有第一个模式的URL

i、 e,localhost/blog/2012/10/12/sample post/应重定向到localhost/blog/sample post/


有人能帮我提供htaccess代码吗?

尝试将这些代码添加到文档根目录中的htaccess文件中。确保它们位于任何wordpress相关规则之前:

RewriteEngine On
RewriteRule ^/?blog/[0-9]{4}/[0-9]{2}/[0-9]{2}/(.*)$ /blog/$1 [L,R=301]

Apaches mod_rewrite附带了一个优秀的文档,其中包含了一些很好的示例,这些示例正好涵盖了您要查找的内容。阅读文档@SyamKumar,空白的htaccess文件和新的apache安装。我已经在下面代码的顶部添加了上述代码
RewriteEngine off suPHP\u ConfigPath/home/peopleco/public\u html/blog/php.ini命令allow,deny,deny,deny,all,BEGIN WordPress RewriteEngine On RewriteBase/blog/RewriteRule^index\.php$-[L]RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule./blog/index.php[L]#END WordPress
你能告诉我具体需要放在哪里吗?我对使用htaccess文件完全是新手。