amin
amin

Reputation: 23

removing date and extention from url with htaccess

I recently changed the permalink format of my blog so the date and extention .php is removed: ago: http://domain.com/2014/09/-cc-tenton-photoshop-cc-for-the-web.php after: http://domain.com/-cc-tenton-photoshop-cc-for-the-web

now i want redirect old link to new link with htaccess and 301 redirect.

Upvotes: 0

Views: 140

Answers (1)

anubhava
anubhava

Reputation: 786081

You can use this rule as very first rule in your wordpress .htaccess file:

RewriteEngine On

RewriteRule ^\d{4}/\d{2}/(.+?)\.php$ /$1 [L,NC,NE,R=301]

Upvotes: 1

Related Questions