htaccess question: remove %post_id% from url and 301 redirect
-
For some reason, I’ve quite a number of posts showing 2 urls in Google Webmaster tools. e.g:
/this_is_a_post/1447/
/this_is_a_post/My permalink structure is
/%postname%/%post_id%/
This is my current htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Both types of urls resolve, but to avoid duplicate issues I want to 301 redirect all requests that include the post_id and just return the postname in the url i.e. /this_is_a_post/
Searched the web but haven’t found a htaccess rule that quite works. Appreciate any help.
- The topic ‘htaccess question: remove %post_id% from url and 301 redirect’ is closed to new replies.