Using mod_negotiation with RewriteMap for language based redirect?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

to provide virtual URLs which are redirected by content negotiation based on the Browsers accept-language header, I use PHP files as follows for example for http://hostname.domain/shorturl which is redirected to http://hostname.domain/de/path/to/file.html for German readers, http://hostname.domain/en/path/to/file.html for English and likewise for 2 other languages.

As I don't like to use PHP on that server at all, other solutions are preferred. Using RewriteMap failed as RewriteMap seems to combine with mod_negotiation or MultiViews only on the destination path (de/path/to/file.html) of the rewrite map not the key (/shorturl).

And to rebuild the internal functions of MultiViews by a list of RewriteCond isn't possible if you want evalution of more elaborated Accept-Language headers like "de-de, de;q=0.75, en-us;q=0.50, en;q=0.25" which MultiViews and mod_negotation eat easily.


file shorturl.php.en:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location:http://"; . $_SERVER["HTTP_HOST"] . "/en/path/to/file.html");
header("Connection:close");
exit;
?>


file product.php.de:

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location:http://"; . $_SERVER["HTTP_HOST"] . "/de/path/to/file.html");
header("Connection:close");
exit;
?>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux