I want to have clean url feature activated for my site which is hosted on a windows server. I've used the way described in http://drupal.org/node/3854 but it's not working with i18n module enabled. when the language phrase stays in front of "q" variable the "page not found" message appears.

Comments

aghajani’s picture

Is there anyone to answer?

jose reyero’s picture

I dont know what you mean by "language phrase stays in front of 'q'". Could you provide some example of links not working?

Btw, Windows server = bad option ;-)

aghajani’s picture

Hi Jose, Sorry for delay.
The problem is whenever I type http://www.test.com/about it works but when I type http://www.test.com/en/about I get Drupal's "page not found" error.

Thanks

aghajani’s picture

anyone knows the answer?
question = drupal + i18n + iis + clean urls
problem = returns drupal's 404 page.
without i18n enabled clean urls work under iis as mentioned in handbook.

Thanks

Bèr Kessels’s picture

I think "the answer" is apache. IIS has ghorrible support for url rewriting, and i18n does some really advanced rewriting. So that answer might sound silly, but it is AFAIK the only solution at the moment.

aghajani’s picture

Sorry I knew this answer before but our company has windows server with IIS on it. Drupal's good structure allows to control URLs in a clean style so we can have clean url in IIS with a piece of code and some changes in website configuration. It must be possible to use it with i18n module installed.

pitpit’s picture

why don't u use url aliasing to make http://www.test.com/en/about working ?

jose reyero’s picture

Well, not really interested in IIS, but we can try to work out something :)

After seeing this page http://drupal.org/node/3854 , which I guess is the code you are using, it seems to me that the problem can be in the following function in i18n.module

function _i18n_get_original_path() {
  return isset($_REQUEST["q"]) ? trim($_REQUEST["q"],"/") : '';
}

Maybe the $_REQUEST variable is not set like in Apache, and then i18n fails to get the original path, and then find an alias for it.

So, if someone can find a solution, maybe some code to be added to the config file, or maybe a patch for i18n.module, we could add some notes to i18n docs or we can try to add that code in the aforementioned help page...

One valid workaround could be to create an alias for en/about as dbdev suggests.

jose reyero’s picture

Priority: Normal » Minor
aghajani’s picture

The "about" is just an example of pathes I have. There are so many other path in this site so it's not wise to manualy build them all. There is also so many content in two language and it's not possible to make alias for all of them.

aghajani’s picture

Status: Active » Fixed

Jose was right. The problem was in _i18n_get_original_path function. It returns the path when the "q" variable is set but nothing when it not (In IIS). So I changed the code like this:

function _i18n_get_original_path() {
  return isset($_REQUEST["q"]) ? trim($_REQUEST["q"],"/") : trim($_SERVER["REQUEST_URI"], "/");
}

Now it works.
Thanks Jose.

Anonymous’s picture

Status: Fixed » Closed (fixed)