Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>In this piece of code, where is establish the destination website?</p> </blockquote> <p>Here:</p> <pre><code>RewriteRule ^$ http://www.example.com/es / [L,R] </code></pre> <p>and here: </p> <pre><code>RewriteRule ^$ http://www.example.com/en / [L,R] </code></pre> <p>No idea if that's a typo or if this is what you have in your htaccess file, but this will produce 500 internal server errors because you are giving <code>RewriteRule</code> 4 parameters, when it only wants either 2 or 3.</p> <p>The other problem is with your <code>%{HTTP_REFERER}</code> regular expression. Apache's probably going to puke here: <code>^*\.domain\.com.ar/</code>, you probably meant: <code>^[^/]*\.domain\.com.ar/</code> or something. So you probably want your rules to look like this:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine on RewriteCond %{HTTP:Accept-Language} ^es [NC] RewriteCond %{HTTP_REFERER} !^[^/]*\.domain\.com.ar/ [NC] RewriteRule ^$ http://www.example.com/es/ [L,R] RewriteCond %{HTTP:Accept-Language} ^en [NC] RewriteCond %{HTTP_REFERER} !^[^/]*\.domain\.be/ [NC] RewriteRule ^$ http://www.example.com/en/ [L,R] &lt;/IfModule&gt; </code></pre> <p>Of course, you'd be replacing the instances of <code>domain.com.ar</code> and <code>domain.be</code> and <code>www.example.com</code> with the correct hostnames.</p> <p>Also note: the <code>Accept-Language</code> header is a complicated string of qualifiers. It isn't as simple as an <code>en</code> or <code>es</code>. A spanish webbrowser could contain both an <code>en</code> and <code>es</code> simply because both are supported languages. Determining an exact language to redirect to based on this header isn't really in the scope of mod_rewrite and htaccess.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload