GroovyDude87
GroovyDude87

Reputation: 125

Nginx replace // with / in URL

We are currently getting web requests with www.domain.com//index.php which are resolving, but causing issues with google. How can we rewrite the request to catch these and redirect to www.domain.com/index.php

Thanks

Upvotes: 1

Views: 657

Answers (1)

sisoft
sisoft

Reputation: 973

By default ngingx merges double-slashes and urls like www.domain.com//index.php works well.

You can turn off merging and make rewrite rule with redirection:

merge_slashes off;
rewrite (.*)//(.*) $1/$2 permanent;

Upvotes: 2

Related Questions