Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To keep your rewriting rules manageable, you're best bet is to transform urls <strong>without</strong> introducing new variables.</p> <p>With your example, it is impossible to use a simple textual replacement to get from somepage.php to sub_page.php and then otherpage.php to sub_page2.php - you will need a new rule for each page, because only you know about the mapping. Its a lot easier of you base the result url on data in the source url.</p> <p>For example, you could devise a scheme whereby:</p> <pre><code>demo.example.com/somepage.php?start=5 </code></pre> <p>transforms into</p> <pre><code>www.example.com/sub_somepage.php?user=demo&amp;start=5 </code></pre> <p>With this scheme, the name of the target script can be derived from the name of the original script. The RewriteRule for this scheme would look like:</p> <pre><code>RewriteRule ^/([A-Za-z0-9_]+\.php) /sub_$1?user=%1 [qsappend] </code></pre> <p>Getting rewrite rules to work correctly can be quite tricky. While you refine your rules, you will probably want to add this to your config:</p> <pre><code>RewriteLog "/tmp/httpd-rewrite.log" RewriteLogLevel 5 </code></pre> <p>You can then check that your rules are doing what you want. More information on how these directives work is at <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" rel="nofollow">httpd.apache.org</a>. In particular, if you want to redirect to a different host to serve content, you'll have to add the new host name to the substitution and the [redirect] flag.</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