Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to replace & and + through rewrite rules for mediawiki?
    primarykey
    data
    text
    <p>I have tried many ways, but without successful result.</p> <p>Target wiki access url: www.example.com/wiki/Ampersand_%26_nextampersand_%26_plus_%2B_nextplus_%2B_text</p> <p>Apache internally process the %26 and %2B as &amp; and + so we need to convert it again to url style. (as mentioned here www.mediawiki.org/wiki/Manual_talk:Short_URL/Ampersand_solution#Another_solution)</p> <p>Following example handles only 1 appearance of &amp; or +, not combined.</p> <pre><code>RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)\&amp;(.*)$ w/index.php?title=$1\%26$2 RewriteRule ^wiki/(.*)\+(.*)$ w/index.php?title=$1\%2B$2 RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^/?wiki/*$ /w/index.php [L,QSA] RewriteRule ^/*$ /w/index.php [L,QSA] </code></pre> <p>The question is how to get all &amp; and + signs replaced by %26 and %2B and finally forwarded to processing index.php.</p> <p>I have tried approaches like</p> <pre><code>RewriteRule ^([^+]*)\+(.*) $1%2B$2 [N] #freezes RewriteRule ^wiki/([^+]*)\+(.*) wiki/$1%2B$2 [N] #freezes </code></pre> <p>and many others (in combinations) from following advices, but I couldn't find working solution.</p> <p><a href="https://stackoverflow.com/questions/1345314/apache-mod-rewrite-replace-character-with-another">Apache Mod Rewrite - Replace : character with another</a></p> <p><a href="https://stackoverflow.com/questions/1279681/mod-rewrite-replace-underscores-with-dashes">mod_rewrite: replace underscores with dashes</a></p> <p>definitely there is a solution as Wikipedia is using some successful way how to do it.</p> <p><a href="http://en.wikipedia.org/wiki/%26_Yet_%26_Yet" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/%26_Yet_%26_Yet</a></p> <p><a href="http://en.wikipedia.org/wiki/C%2B%2B" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/C%2B%2B</a></p> <p>Any ideas? Thank you.</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.
 

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