Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess 301 redirect all pages within directory to other domain without querystring
    text
    copied!<p>This question probably has been answered, but I cannot seem to find a fitting solution.</p> <p>I would like to 301 redirect all pages like the ones below</p> <pre><code>http://www.domain1.com/nl/dolor/sith http://www.domain1.com/nl/loremipsum http://www.domain1.com/nl </code></pre> <p>To a new domain, and at the same time drop the querystring, like so:</p> <pre><code>http://www.domain2.nl </code></pre> <p>All other pages, such as <a href="http://www.domain1.com/be/loremipsum" rel="nofollow">http://www.domain1.com/be/loremipsum</a> should still work. Only the ones with suffix <code>nl</code> should redirect. </p> <p>Please note that these are not real directories: in my .htaccess file I've got the following statements to rewrite my query string:</p> <pre><code># Personal Rewrites RewriteRule ^([A-Za-z0-9-_]+)/?$ index.php?lid=$1 [L] RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ index.php?lid=$1&amp;pl1=$2 [L] RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ index.php?lid=$1&amp;pl1=$2&amp;pl2=$3 [L] RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ index.php?lid=$1&amp;pl1=$2&amp;pl2=$3&amp;pl3=$4 [L] RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ index.php?lid=$1&amp;pl1=$2&amp;pl2=$3&amp;pl3=$4&amp;pl4=$5 [L] RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)/?$ index.php?lid=$1&amp;pl1=$2&amp;pl2=$3&amp;pl3=$4&amp;pl4=$5&amp;pl5=$6 [L] </code></pre> <p>I've tried the traditional rewrite, but this also sends the querystring:</p> <pre><code>Redirect 301 /nl http://www.domain2.nl </code></pre> <p>Other techniques do not seem to work. And I'm not good at regexes...</p> <p>Could someone give or link to a fitting solution? Thanks in advance</p>
 

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