Drupal - How to avoid Drupal redirecting my multilingual Views pages?
i18n_path submodule
I assume you're also using the i18n module. So make sure you also enabled the i18n_path
submodule (= Path translation). More details about it, from the community documentation (bold markup added here):
... allows you to map together existing pages that are translations of each other. This will allow users to use the language switcher to navigate between the associated pages.
The module is meant to be used as a last resort to translate paths that can't otherwise be mapped together as translations. For example, paths to translated nodes can already be linked with the Content translation module and paths to translated taxonomy terms can be linked with the Taxonomy translation module. Path translations should be used to link generic paths, such as those provided by Views or Panels.
To set up translations of a particular path, you need to create a path translation set by going to Configuration > Regional and language > Translation sets > Paths and clicking Add path translation.
i18n page views
You may also want to check if you can get it to work using the i18n page views module. Some details from its project page:
... provides a new display of views, where you can select different paths for each language enabled on your site, so a view has a localized route for each language.
Note 1: "if you cannot find any option in the view to translate the path" (as in your comment below), then you may want to have a look at what's mentioned in Comment #1 of issue 2389535, which states:
... May be you have chosen a page display rather than a i18n page display when you created your view. Please be sure that you selected the correct views display. I attach some screenshots for helping:
Screenprint 1:
Screenprint 2:
Note 2: To answer the question about "Will I have to create the whole view page again to make it as an i18n_page?" (as in one of your (now deleted) comments below this answer), I would give it a try using either of the approaches described in the answers to the question at How to duplicate a Views display (which is not the master) as a different display type? ... If that doesn't work / apply, then recreation of the whole view page seems like the only option left.
Remove the path-alias and try coding this special case yourself, using
hook_url_inbound_alter and or hook_url_outbound_alter
or just do your own paths via custom page callbacks (hook_menu) and then show the view with views_embed_view.
You could also alter the action of the exposed filter's form:
/**
* Implements hook_form_alter().
*/
function foo_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'views_exposed_form') {
$form['#action'] = current_path();
}
}
Or:
/**
* Implements hook_form_views_exposed_form_alter().
*/
function foo_form_views_exposed_form_alter(&$form, &$form_state) {
if ($form['#id'] == 'views-exposed-form-foo-default') { // Or: if ($form['#action'] === '/foo')
$form['#action'] = '/bar';
}
}
Taken form here How do I change submit URL for exposed search filter?