Note that there are some explanatory texts on larger screens.

plurals
  1. POapache rewrite conflict
    primarykey
    data
    text
    <p>I know something's conflicting but being a mod rewrite Muggle it's time to ask for help.</p> <p>I am re-writing <a href="http://test.com/[name]/" rel="nofollow noreferrer">http://test.com/[name]/</a><br> to <a href="http://test.com/script.php?id=[name]" rel="nofollow noreferrer">http://test.com/script.php?id=[name]</a><br> with success, using:</p> <pre><code>(rule#1) RewriteRule ^(.*)\/$ script.php?id=$1&amp;%{QUERY_STRING} [L] </code></pre> <p>Next, I rewrite <a href="http://test.com/[name]/foobar/[key]" rel="nofollow noreferrer">http://test.com/[name]/foobar/[key]</a><br> to <a href="http://test.com/script.php?id=[name]&amp;foobar=[key]" rel="nofollow noreferrer">http://test.com/script.php?id=[name]&amp;foobar=[key]</a><br> also with success, using:</p> <pre><code>(rule#2) RewriteRule ^(.*)\/foobar/([0-9]+)$ script.php?id=$1&amp;foobar=$2 [L] </code></pre> <p>However, when I try to include the query strings,<br> so that <a href="http://test.com/[name]/foobar/[key]?p=[page]" rel="nofollow noreferrer">http://test.com/[name]/foobar/[key]?p=[page]</a><br> could be re-written to <a href="http://test.com/script.php?id=[name]&amp;foobar=[key]&amp;p=[page]" rel="nofollow noreferrer">http://test.com/script.php?id=[name]&amp;foobar=[key]&amp;p=[page]</a><br> with this:</p> <pre><code>(rule#3) RewriteRule ^(.*)\/foobar/([0-9]+)$ script.php?id=$1&amp;foobar=$2&amp;%{QUERY_STRING} [L] </code></pre> <p>then Apache just throws me back to <a href="http://test.com/script.php" rel="nofollow noreferrer">http://test.com/script.php</a>. </p> <p><del>I know from trial and error that rule#3 would work if it did not use the same script.php as rule#1,<br> but I have no idea how to fix it, so any help appreciated!</del></p> <p>Arrgh..after double-checking my rules with Gumbo's examples, I finally found out what went wrong. Although not perfect, my rewrite rules were actually working as intended. However I totally forget that I had another script that checks for valid parameters... apparently, throwing random test values, sometimes is not a good idea. Thanks for the ^/ trick though!</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