Re: language-based redirection

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

 



On Feb 7, 2008 5:02 AM, Zbigniew Szalbot <zszalbot@xxxxxxxxx> wrote:
> 2008/2/4, Joshua Slive <joshua@xxxxxxxx>:
>
> > On Feb 4, 2008 1:43 AM, Zbigniew Szalbot <zszalbot@xxxxxxxxx> wrote:
> >
> > > The thing is that in order to provide blogs in two languages I cannot
> > > install one blog and make it display in two languages. It needs to be
> > > two blogs. Hence, they need to be in two separate directories. But I
> > > am happy to do the langauge recognition in a common directory and then
> > > redirect to a specific blog. Thank you!
> >
> > If you want the full language negotiation done by apache (checking
> > priorities, etc), then your meta-refresh hack may indeed be the best
> > idea. (I almost never suggest that, since it is much better to do
> > proper HTTP redirects. But this is a special case. I don't know a
> > clean way to get mod_negotiation to generate an external redirect.)
> >
> > If you just want to do a simple scan of the browser's accept-language,
> > you can use mod_rewrite:
> >
> > RewriteCond %{HTTP:Accept-Language} ^pl$
> > RewriteRule ^/blog/?$ http://yoursite.example.com/blog/pl/ [R,L]
> > RewriteRule ^/blog/?$ http://yoursite.example.com/blog/en/ [R]
>
> One more question here... the above does not work. I even pointed it
> to another file in the current directory (blog)
>
> RewriteRule ^/blog/?$ http://yoursite.example.com/blog/file.html [R,L]
>
> but it would not open it either.
>
> error log says nothing.

If you are going to use mod_rewrite, you unfortunately are going to
need to dig into its docs to understand what you are doing. It's not
fun, but it is necessary.

Just to get you started, when using mod_rewrite in an .htaccess file,
references become relative, so you need to remove the leading / at
least. See the RewriteBase directive.

Joshua.

---------------------------------------------------------------------
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