{"id":558023,"date":"2007-05-01T20:10:33","date_gmt":"2007-05-01T20:10:33","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/mod_rewrite-remove-string\/"},"modified":"2016-08-18T22:50:50","modified_gmt":"2016-08-18T22:50:50","slug":"mod_rewrite-remove-string","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/mod_rewrite-remove-string\/","title":{"rendered":"mod_rewrite: remove string"},"content":{"rendered":"<p>Hi folks,<\/p>\n<p>I&#8217;m currently migrating my blog to wordpress. Seems to work just fine, but I also want to migrate some of my old permalinks, because there are some links in the net pointing at them. Basically, it should be possible to do with mod_rewrite, but I can&#8217;t get it working.<\/p>\n<p>Example of old permalink:<\/p>\n<p>http:\/\/domain\/blog\/fixedstring\/variablestring\/2007\/05\/01\/entry<\/p>\n<p>Same post with new permalink:<\/p>\n<p>http:\/\/domain\/2007\/05\/01\/entry<\/p>\n<p>So basically I have to remove &#8220;blog\/fixedstring\/variablestring\/&#8221;. I would write the following rule:<\/p>\n<p>(^blog\/fixedstring\/.[a-z]*\/)(.*) $2<\/p>\n<p>This works, if I use it outside of wordpress, but I don&#8217;t know how to integrate it with the standard wordpress .htaccess file. I thought it must work as follows:<\/p>\n<pre><code># BEGIN WordPress\n&lt;IfModule mod_rewrite.c&gt;\nRewriteEngine On\nRewriteBase \/\nRewriteRule (^blog\/fixedstring\/.[a-z]*\/)(.*) $2\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . \/index.php [L]\n&lt;\/IfModule&gt;\n\n# END WordPress<\/code><\/pre>\n<p>Does anybody knows what is going wrong?<\/p>\n<p>Regards,<\/p>\n<p>Sebastian<\/p>\n","protected":false},"template":"","class_list":["post-558023","topic","type-topic","status-closed","hentry","topic-tag-htaccess","topic-tag-mod_rewrite"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/558023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/558023\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=558023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}