Reputation: 1554
I need to redirect all URLs formatted as http://www.example.org/dir/subdir/
to http://subdomain.example.org/subdir/
. For example, http://www.example.org/dir/subdir/page
would redirect to http://subdomain.example.org/subdir/page
.
I tried rewrite ^(/dir/subdir.*) http://subdomain.example.org$1 permanent;
, but this keeps the /dir/
part, which I want to omit.
Upvotes: 0
Views: 23
Reputation: 110
Your rewrite rule is capturing the /dir/ part too. Try this:
location /dir/subdir {
rewrite ^/dir(.*)$ http://subdomain.example.org$1 permanent;
}
Upvotes: 1