Home rewrite old url to new one
Reply: 1

rewrite old url to new one

Angelo Published in 2017-12-05 22:00:18Z

I have this is current url pattern for a group of urls


which will be changing to


How do I use mod_rewrite to rewrite these urls to the new pattern using .htaccess file?

I have this so far but it is not working...

RewriteRule /assets/img/(.*) /assets/img/all_banners/$1 [R=301,NC,L,QSA]

Maybe the flags are wrong?

anubhava Reply to 2017-12-05 22:17:48Z

You can use this rule as your very first rule:

RewriteEngine On

RewriteRule ^/?(assets/img)/([\w-]+\.[a-z]+)$ /$1/all_banners/$2 [R=301,NC,L,NE]

Make sure to clear your browser cache or use a new browser for testing.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301928 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO