i have setup following rules in .htaccess
:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / // redirect old blog urls new location rewritecond %{http_host} ^www.objectsanduse.com/blog/$ rewriterule ^(.*)$ http://www.objectsanduse.com/$1 [r=301,l] // wordpress rewrite rules rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule>
the url http://www.somedomain.com/blog/2016/01/19/some-post/
redirects correctly http://www.somedomain.com/2016/01/19/some-post/
but http://www.somedomain.com/blog
redirects http://www.somedomain.com//2015/03/30/some-other-post
if have understood correctly need single rule:
rewriterule ^(blog\/?)(.*) http://%{http_host}/$2 [r=301,l]
this rule takes old uri starting blog
(optionally followed /
)
and captures follows (where includes "nothing @ all").
then rewrites uri, containing second capture group without preceding blog/
.
Comments
Post a Comment