Results 1 to 5 of 5

Thread: mod_rewrite and regular expressions

  1. #1
    Join Date
    Jul 2002
    Posts
    189

    Unhappy mod_rewrite and regular expressions

    Hello,

    I'm having hard times to figure out how to get a right expression for mod_rewrite:

    this is my line:
    RewriteRule ^category-([0-9]+)-([0-9]+)-([0-9]\+[0-9]).html$ /browse.php?pg_which=$1&cat=$2&order=$3

    The first and second variable are ok. But I can't get the third one.

    My query is as following:
    http://mywebsite.de/category-2-52-bid+desc.html

    How do I get the "bid+desc" with regular expressions for mod_rewrite ?

    Hope someone can help

    Joerg
    --------- applying hacks require a knack ---------

  2. #2
    Join Date
    Aug 2002
    Posts
    92

    Default

    check out this thread. it should give you most of what you need.

    http://www.nicecoder.com/community/s...p?threadid=853

    here are some hints
    your htaccess should look like this i believe

    RewriteRule ^category-([0-9]+)-([0-9]+)-([a-z]*)+([a-z]*).html$ /browse.php?pg_which=$1&cat=$2&sort_by=$3&sort_orde r=$4

    youll have to change some things in browse.php and in pagination.class.php also.

    i hope this gets you on the right track. good luck!

  3. #3
    Join Date
    Jul 2002
    Posts
    189

    Default

    Hello scheetz,

    it's finally working !

    The following line does it's job:
    RewriteRule ^category-([0-9]+)-([0-9]+)-([a-z](.*)[a-z]).html$ /browse.php?pg_which=$1&cat=$2&sort=$3

    I also just had the wrong variable name means order instead of sort!

    thanks anyway

    Joerg
    --------- applying hacks require a knack ---------

  4. #4
    Join Date
    Jul 2002
    Posts
    189

    Default

    Yo,

    just got one more problem!

    If you modify pagination.class all sites with pagination will be affected! It's not worth to rewrite all the code to get the pagination for category view! How did you solve this problem?

    Could you post me your pagination class here. I actually think you forgot to post it at your previous thread!

    Joerg
    --------- applying hacks require a knack ---------

  5. #5
    Join Date
    Jul 2002
    Posts
    189

    Default

    for everyone who is interrested in:

    I simply did a second pagination class pagination_browse.class
    and included this from application_browse.php in browse.php.

    This might be not the best way to solve this problem - but it works!

    Joerg
    Last edited by tjoerg; 08-06-2003 at 08:56 AM.
    --------- applying hacks require a knack ---------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •