Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api/ redirect #271

Closed
dbvcode opened this issue May 24, 2016 · 3 comments
Closed

api/ redirect #271

dbvcode opened this issue May 24, 2016 · 3 comments

Comments

@dbvcode
Copy link

dbvcode commented May 24, 2016

Hi,
I have a WebAPI in my MVC project configured like this in the WebApiConfig.cs

        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }

If I turn off i18n the api works like a charm.
When i18n is on (references loaded) whenever I go to /api/{controller}/{action}/{id} I get redirected to /{controller}/{action}/{id}

How can I override this redirect? Or even better how can I use i18n with the WebApi?

Thanks.

@turquoiseowl
Copy link
Owner

Please see #240

@turquoiseowl
Copy link
Owner

The setting i18n.UrlLocalizer.QuickUrlExclusionFilter may be of help.

https://github.com/turquoiseowl/i18n#exclude-urls-from-being-localized

@dbvcode
Copy link
Author

dbvcode commented May 24, 2016

Thanks, I took /api out from being localized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants