Search code examples
mysqlmod-rewriteurl-rewritingcontent-management-systemphp-5.3

Rewrite rule needed for cms php melody urls rebuilding


I have recently upgraded my website cms from older version to new one, Everything was fine except the old video urls are built on that format:

www.example.com/artist_name/videoUrl_ID.html

the artist name field is removed from database to fit new database architecture.. and to avoid that problem, i need to rewrite those urls to:

www.example.com/videoUrl_ID.html

which means removing this artist_name field from the urls(old urls published on the web)

{$video_data.uniq_id}: code i use to call video id. Expaple:

http://www.example.com/CNN_News/news-march-30-2016_3a7017eff.html

Must be changed to:

http://www.example.com/news-march-30-2016_3a7017eff.html

Solution

  • You can try this rule in site root .htaccess:

    RedirectMatch 302 ^/[\w-]+/([\w-]+\.html)$ /$1