modernmagic
modernmagic

Reputation: 141

Remove number from URL

I am trying to remove some directories and the number from the URL.

I can remove the DIRs but not the number.

Existing URL: domain.com/enews/item/1765-septic-shock-nothing-is-black-and-white

New URL domain.com/septic-shock-nothing-is-black-and-white

This was my attempt, but it is not removing the number:

RewriteEngine On
RewriteRule ^enews/item/[0-9](.*)$ /$1 [L,R=301]

Upvotes: 0

Views: 137

Answers (1)

modernmagic
modernmagic

Reputation: 141

Figured it out. You need to use this:

RewriteRule ^enews/item/[0-9]+-(.*)$ /$1 [L,R=301]

Upvotes: 1

Related Questions