mod_rewrite: remove string
-
Hi folks,
I’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’t get it working.
Example of old permalink:
https://domain/blog/fixedstring/variablestring/2007/05/01/entry
Same post with new permalink:
https://domain/2007/05/01/entry
So basically I have to remove “blog/fixedstring/variablestring/”. I would write the following rule:
(^blog/fixedstring/.[a-z]*/)(.*) $2
This works, if I use it outside of wordpress, but I don’t know how to integrate it with the standard wordpress .htaccess file. I thought it must work as follows:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule (^blog/fixedstring/.[a-z]*/)(.*) $2 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Does anybody knows what is going wrong?
Regards,
Sebastian
- The topic ‘mod_rewrite: remove string’ is closed to new replies.