Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

redirect german traffic with mod rewrite

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
server-status reporting wrong traffic - Hi, The shows me apache had 22.3 MB since it was started exactly 1 day ago. But when analyzing the logs (And count rules in the firewall) it's more like 223Mb. Are there any known issues why this counting by apache could go..

rewrite url - Hi, I have two domain names on the same (IP-host based). How can I redirect one of the domains to another ? Regards and the best wishes for 2004. Michael

Mod rewrite - Hallo, I have write in a .htaccess File something like this: On !-d !-f [L] I..

mod-rewrite - I am to use to chnage my created pages into static urlls for search engine I am unable to get the rewrite to work, it doesn't seem to do anything. Here is the code on

Mod Rewrite help - I've got 10,000+ files in a folder i.e. ... Several years, many months of html docs. We have so many files in this one folder, I've..
Next:  Apache: Mail Server for a Noob  
Author Message
user2480

External


Since: Sep 19, 2003
Posts: 5



(Msg. 1) Posted: Wed Jan 07, 2004 3:11 pm
Post subject: redirect german traffic with mod rewrite
Archived from groups: alt>apache>configuration (more info?)

Hello,

I am wondering how those big sites like google redirect specific
internet traffic. Is it possible to create a rewrite rool containing the
german, austrian and swiz ip adresses and shift this traffic a german site?

The only thing I found is this:
RewriteCond %{REMOTE_ADDR} =nnn.nnn.nnn.nnn

But this goes only for one IP adress and not for a complete range.

Does anybody know how to do that?

Thanx for any help on that,

Merlin

 >> Stay informed about: redirect german traffic with mod rewrite 
Back to top
Login to vote
mfuhr

External


Since: Nov 17, 2003
Posts: 44



(Msg. 2) Posted: Wed Jan 07, 2004 3:11 pm
Post subject: Re: redirect german traffic with mod rewrite [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Merlin <news.letters.TakeThisOut@web.de> writes:

 > I am wondering how those big sites like google redirect specific
 > internet traffic. Is it possible to create a rewrite rool containing the
 > german, austrian and swiz ip adresses and shift this traffic a german site?

What's the purpose of this redirect? Is the user's country important,
or is it really the user's language that matters? If the latter, then
have a look at the Content Negotiation documentation:

<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/content-negotiation.html" target="_blank">http://httpd.apache.org/docs-2.0/content-negotiation.html</a>
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs/content-negotiation.html" target="_blank">http://httpd.apache.org/docs/content-negotiation.html</a>

 > The only thing I found is this:
 > RewriteCond %{REMOTE_ADDR} =nnn.nnn.nnn.nnn
 >
 > But this goes only for one IP adress and not for a complete range.
 >
 > Does anybody know how to do that?

You could omit the "=" and use a regular expression. The URL
Rewriting Guide has examples:

<a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/misc/rewriteguide.html" target="_blank">http://httpd.apache.org/docs-2.0/misc/rewriteguide.html</a>
<a style='text-decoration: underline;' href="http://httpd.apache.org/docs/misc/rewriteguide.html" target="_blank">http://httpd.apache.org/docs/misc/rewriteguide.html</a>

You could also use a module like mod_geoip to map the IP address
to a country and then make decisions based on the country:

<a style='text-decoration: underline;' href="http://www.maxmind.com/app/mod_geoip" target="_blank">http://www.maxmind.com/app/mod_geoip</a>

Note: there's no way to guarantee what country a user is in by
examining the user's IP address. The organization that owns the
IP address might have international operations, or the user's real
IP address might be hidden by a firewall or proxy.

--
Michael Fuhr
<a style='text-decoration: underline;' href="http://www.fuhr.org/~mfuhr/" target="_blank">http://www.fuhr.org/~mfuhr/</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: redirect german traffic with mod rewrite 
Back to top
Login to vote
user2480

External


Since: Sep 19, 2003
Posts: 5



(Msg. 3) Posted: Thu Jan 08, 2004 6:38 pm
Post subject: Re: redirect german traffic with mod rewrite [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello Michael,

thank your for your help. You wrote that it is possible via apache and
the browser language to redirect traffic.
This is exacly what I am searching for. I am launching a german site
while the english one exists now for quite a while. Now I would like to
redirect the german community members to the new german site, or even
better give them a popup with the info that a german site is available.

I tryed to understand what the apache docs said here:
<font color=purple>  > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/content-negotiation.html</font" target="_blank">http://httpd.apache.org/docs-2.0/content-negotiation.html</font</a>>

But I did not get it. I do have a .htaccess file. Can I just put one or
two lines in there and redirect germans to xx.de?

Thanx for your help,

Merlin

PS: I think google does it the same way?!



Michael Fuhr schrieb:
 > Merlin <news.letters.RemoveThis@web.de> writes:
 >
 >
  >>I am wondering how those big sites like google redirect specific
  >>internet traffic. Is it possible to create a rewrite rool containing the
  >>german, austrian and swiz ip adresses and shift this traffic a german site?
 >
 >
 > What's the purpose of this redirect? Is the user's country important,
 > or is it really the user's language that matters? If the latter, then
 > have a look at the Content Negotiation documentation:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/content-negotiation.html</font" target="_blank">http://httpd.apache.org/docs-2.0/content-negotiation.html</font</a>>
<font color=purple> > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs/content-negotiation.html</font" target="_blank">http://httpd.apache.org/docs/content-negotiation.html</font</a>>
 >
 >
  >>The only thing I found is this:
  >>RewriteCond %{REMOTE_ADDR} =nnn.nnn.nnn.nnn
  >>
  >>But this goes only for one IP adress and not for a complete range.
  >>
  >>Does anybody know how to do that?
 >
 >
 > You could omit the "=" and use a regular expression. The URL
 > Rewriting Guide has examples:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/misc/rewriteguide.html</font" target="_blank">http://httpd.apache.org/docs-2.0/misc/rewriteguide.html</font</a>>
<font color=purple> > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs/misc/rewriteguide.html</font" target="_blank">http://httpd.apache.org/docs/misc/rewriteguide.html</font</a>>
 >
 > You could also use a module like mod_geoip to map the IP address
 > to a country and then make decisions based on the country:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.maxmind.com/app/mod_geoip</font" target="_blank">http://www.maxmind.com/app/mod_geoip</font</a>>
 >
 > Note: there's no way to guarantee what country a user is in by
 > examining the user's IP address. The organization that owns the
 > IP address might have international operations, or the user's real
 > IP address might be hidden by a firewall or proxy.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: redirect german traffic with mod rewrite 
Back to top
Login to vote
mfuhr

External


Since: Nov 17, 2003
Posts: 44



(Msg. 4) Posted: Thu Jan 08, 2004 8:41 pm
Post subject: Re: redirect german traffic with mod rewrite [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Merlin <news.letters DeleteThis @web.de> writes:

 > thank your for your help. You wrote that it is possible via apache and
 > the browser language to redirect traffic.
 > This is exacly what I am searching for. I am launching a german site
 > while the english one exists now for quite a while. Now I would like to
 > redirect the german community members to the new german site, or even
 > better give them a popup with the info that a german site is available.
 >
 > I tryed to understand what the apache docs said here:
<font color=green>  > > <a style='text-decoration: underline;' href="http://httpd.apache.org/docs-2.0/content-negotiation.html</font" target="_blank">http://httpd.apache.org/docs-2.0/content-negotiation.html</font</a>>
 >
 > But I did not get it. I do have a .htaccess file. Can I just put one or
 > two lines in there and redirect germans to xx.de?

Content negotiation allows you to create files for different languages
and have the web server automatically choose one based on the user's
language preferences. For example, if you have "Options +MultiViews"
set for a directory, then you could put the following files in that
directory:

index.html.en
index.html.de

If the user's preferred language is English, then Apache would serve
index.html.en; if the preferred language is German, then Apache
would serve index.html.de. If the preferred language is something
else, then the LanguagePriority and ForceLanguagePriority directives
determine what happens: you can have Apache use a default language,
or you can have it ask the user to choose from the available
languages.

Having Apache redirect the user to another web site based on their
language preference involves a little more work. A simple -- but
flawed -- way to do this with mod_rewrite would be:

RewriteEngine on
RewriteCond %{HTTP:Accept-Language} ^de
RewriteRule (.*) <a style='text-decoration: underline;' href="http://xx.de/$1" target="_blank">http://xx.de/$1</a> [R,L]

This method is flawed because it works only if the Accept-Language
header from the user's browser has "de" listed first. Having the
preferred language listed first is common but isn't required, and
the above method doesn't allow for German being acceptable but not
preferred (e.g., the user might prefer Italian but will accept
German if Italian isn't available). See RFC 2616 Section 14.4 for
more information about how the Accept-Language header works:

<a style='text-decoration: underline;' href="http://www.rfc-editor.org/rfc/rfc2616.txt" target="_blank">http://www.rfc-editor.org/rfc/rfc2616.txt</a>

A more reliable way to force a redirect would be to allow content
negotiation to select a file based on the user's language preferences
and have that file issue the redirect. You could use CGI or PHP
to do this, or you could put the following in the <head> section
of an HTML file:

<meta http-equiv=refresh content="0;URL=http://xx.de/">

Note that using http-equiv=refresh is considered bad style by some
people because it can break the browser's "back" button:

<a style='text-decoration: underline;' href="http://www.w3.org/QA/Tips/reback" target="_blank">http://www.w3.org/QA/Tips/reback</a>

Using CGI or PHP to send an HTTP redirect would probably be better.

--
Michael Fuhr
<a style='text-decoration: underline;' href="http://www.fuhr.org/~mfuhr/" target="_blank">http://www.fuhr.org/~mfuhr/</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: redirect german traffic with mod rewrite 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]