Reputation: 245
I would like to move all content from /downloads/assets/
folder to /downloads/
folder.
How do I add redirect for /downloads/assets/{anystring}
to /downloads/{anystring}
?
Now I manually add every redirect like this:
RewriteRule ^downloads/assets/views?$ /downloads/views [L]
But it's a dream job. Can we use variables instead?
Upvotes: 0
Views: 64
Reputation: 270795
Spend some time with the RewriteRule
documentation, as this is a very rudimentary usage. You will need to capture everything after assets/
in (.*)
and rewrite it as $1
.
RewriteEngine On
RewriteRule ^downloads/assets/(.*) downloads/$1 [L]
The above will perform a silent internal rewrite. If you need to redirect the browser rather than silently rewrite, use [L,R=301]
instead of [L]
.
Upvotes: 1