How remove numbers from url using RewriteRule in .htaccess file?

25 Views Asked by At

I want to Rewrite my url using .htaccess file using php as I got hundreds of url's like this and I don't want to add individual RewriteRule for these many url's.

I want to remove numbers from start of url and replace with specific url like below examples

For example 1,

I want to replace this url: https://www.example.com/2023/03/03/5-abc-blog-name-or-url/

To this: https://www.example.com/blog/5-abc-blog-name-or-url/

For example 2,

I want to replace this url: https://www.example.com/2022/04/01/abc-xyz-blog-name-or-url-235/

To this: https://www.example.com/blog/abc-xyz-blog-name-or-url-235/

Please help me with this.

Thank you so much in advance.

I have tried this but this isn't working for me

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)$/ /blog/$ [L]
0

There are 0 best solutions below