Results 1 to 8 of 8
  1. #1
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    I've been banging my head a little with this

    I was able to create the RewriteRule below to send a user who follows the link http://anydom.com/scriptname/25/foo.html to /scriptname.php?page=25&anyvar=foo

    <pre class="ip-ubbcode-code-pre">
    RewriteRule ^scriptname/(.*)/(.*)(\.[^/]+)$ /scriptname.php?page=$1&anyvar=$2
    </pre>

    But is it possible to create the link to look like this http://anydom.com/scriptname/foo-pg25.html

    Thanks!

  2. #2
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    RewriteRule ^scriptname/(.*)/(.*)(\.[^/]+)$ /scriptname/$2-pg$1.html

    OR

    RewriteRule ^scriptname/(.*)/(.*)(\.[^/]+)$ /scriptname/$2-pg$1$3

    Just a guess.

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  3. #3
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>RewriteRule ^scriptname/(.*)/(.*)(\.[^/]+)$ /scriptname/$2-pg$1$3<HR></BLOCKQUOTE>Thanks Buddha, however the change has to be within the "match part" of the rewrite rule.... ^scriptname/(.*)/(.*)(\.[^/]+)$

  4. #4
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    RewriteRule ^scriptname/([^\d]*)(\d+)(\.[^/]+)$ /scriptname.php?page=$2&anyvar=$1

    but that would be '&anyvar=foo-' is that what you want or

    RewriteRule ^scriptname/([^\d\-]*)-(\d+)(\.[^/]+)$ /scriptname.php?page=$2&anyvar=$1

    which should be '&anyvar=foo'?

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  5. #5
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    hmmm... it still doesn't work... variable $1 gets set to foo-pg28 and variable $2 is unset

  6. #6
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Ok, I tested this one. Got it working on my server.

    But, I don't know how your doing this config or .htaccess?

    if it's config or a directory above /scriptname/ then it's something like this:

    RewriteRule ^[^/]*scriptname/(.+)-pg([0-9]+)\.(.+)$ scriptname.php?page=$2&anyvar=$1

    if it's .htaccess in the directory /scriptname/ it's something like this:

    RewriteRule ^(.+)-pg([0-9]+)\.(.+)$ scriptname.php?page=$2&anyvar=$1

    Either way it's a couple more for you to try.

    I'm off to a hot bath I got a Migrain. Haven't had one in years. Teach me to be nice to mother.

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  7. #7
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    Thanks Buddha, yes, using it in .htaccess and with a little work, this method works great thanks!!

  8. #8
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Your welcome TJ.

    ------------------------------
    "Everybody gets so much information all day long that they lose their common sense." - Gertrude Stein, American author (1874-1946).

  9. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Help Mod rewrite
    By womanht in forum Programming / Datafeeds / Tools
    Replies: 4
    Last Post: April 10th, 2007, 10:01 PM
  2. dyse mod-rewrite & FrontPage
    By traffic-tart in forum Cusimano.com Scripts
    Replies: 1
    Last Post: August 21st, 2005, 02:27 PM
  3. Mod Rewrite and Dynamic Titles
    By barb45684 in forum Cusimano.com Scripts
    Replies: 6
    Last Post: June 27th, 2005, 02:29 PM
  4. mod rewrite - I just don't get it
    By tamborinegal in forum Programming / Datafeeds / Tools
    Replies: 12
    Last Post: April 20th, 2004, 06:59 AM
  5. Mod Rewrite Question
    By swampy_webber in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: January 13th, 2004, 04:39 PM

Posting Permissions

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