The MU forums have moved to WordPress.org

Can someone explain the rewrite rules for me? :o) (4 posts)

  1. barrybell
    Member
    Posted 18 years ago #

    Specifically, what is going on here...?


    RewriteRule ^([_0-9a-zA-Z-]+)/([0-9]{4})/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-zA-Z-]+)?/?([0-9]+)?/?$ /wp-inst/index.php?wpblog=$1&year=$2&monthnum=$3&day=$4&name=$5&page=$6 [L]

    Is the ([_0-9a-zA-Z-]+) part the domain name of the blog or just the name of the blog?

  2. Inviz
    Inactive
    Posted 18 years ago #

    to get the thing u ask try to replace your rule with

    RewriteRule ^([_0-9a-zA-Z-]+)/([0-9]{4})/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-zA-Z-]+)?/?([0-9]+)?/?$ /wp-inst/test.php?wpblog=$1&year=$2&monthnum=$3&day=$4&name=$5&page=$6 [L]

    then create test.php and there add:

    <?
    print_r($_GET);
    ?>

    and then u will understand :)

    Regards, Inviz

  3. tom_cat
    Inactive
    Posted 18 years ago #

    http://jakarta.apache.org/regexp/applet.html

    Use this applet to check the regular expression.

  4. VaamYob
    Inactive
    Posted 18 years ago #

    In English:
    "^" means - from the beginning of the request URL (no host),
    "([_0-9a-zA-Z-]+)" means - look for an _, a number, a letter or a - (if any),
    if there is a match, then put that in variable 1

    "/" means - after that look for a /,

    "([0-9]{4})" means - then look for a four digit number and put that in variable 2

    "/?" means - then there may be a /

    "([0-9]{1,2})?" means - now look for 1 to 2 digit number (optional) and put that in variable 3

    "([0-9]{1,2})?" means - now look for another 1 to 2 digit number (optional) and put that in variable 4

    "([_0-9a-zA-Z-]+)?" means - look for some (optional) number/letters/-/_ and put that in variable 5

    "([_0-9a-zA-Z-]+)?" means - look for some (optional) numbers and put that in variable 6

    The rest says to use variables 1-6 to create the url that will be used to access your wordpress site.

About this Topic

  • Started 18 years ago by barrybell
  • Latest reply from VaamYob