+ Post New Thread
Results 1 to 2 of 2
*nix Thread, apache mod_rewrite in Technical; Hey Two questions, how can i match a url with a dot in it, currently im using a line like ...
  1. #1

    Join Date
    Jan 2007
    Location
    Durham, UK
    Posts
    328
    Thank Post
    33
    Thanked 17 Times in 12 Posts
    Rep Power
    20

    apache mod_rewrite

    Hey

    Two questions, how can i match a url with a dot in it, currently im using a line like this,
    Code:
    RewriteRule ^music/([^/\.]+)/images/?$ artist/images.php?artist=$1
    but when there's an artist such as Run D.M.C. it doesn't work, and i dont know enough about regular expressions to know how to fix it :P

    I've also got a url which should be something like
    Code:
    /music/ARTIST/ALBUM/
    so how can i make this work while also keeping the /music/ARTIST/images/ working?

    Thanks
    Jack

  2. #2
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    119
    Quote Originally Posted by Jackd View Post
    Two questions, how can i match a url with a dot in it, currently im using a line like this,
    Code:
    RewriteRule ^music/([^/\.]+)/images/?$ artist/images.php?artist=$1
    but when there's an artist such as Run D.M.C. it doesn't work, and i dont know enough about regular expressions to know how to fix it :P
    Code:
    ^music/([A-Za-z0-9_\-]+[A-Za-z0-9_\-/\.]+)/images/(.)*$
    That matches a single character WITHOUT a dot in it before it matches the rest of the artists name (to avoid someone trying a ../ style redirect) and should work... Probably not efficient though.

    I've also got a url which should be something like
    Code:
    /music/ARTIST/ALBUM/
    so how can i make this work while also keeping the /music/ARTIST/images/ working?
    Given that you will probably find an album called "images" I think that's a mission impossible.. I'd reorganise that IMHO.



SHARE:
+ Post New Thread

Similar Threads

  1. [Ubuntu] Apache question
    By Batman in forum *nix
    Replies: 7
    Last Post: 13th May 2009, 02:28 PM
  2. Apache VirtualHosts
    By TechMonkey in forum Web Development
    Replies: 7
    Last Post: 6th January 2009, 02:27 PM
  3. Apache rewrite
    By Michael_84 in forum Web Development
    Replies: 0
    Last Post: 1st December 2008, 01:57 PM
  4. Apache 2.2 configuration
    By saundersmatt in forum Web Development
    Replies: 3
    Last Post: 12th July 2008, 10:17 AM
  5. Apache realms...again
    By HodgeHi in forum Mac
    Replies: 1
    Last Post: 28th January 2008, 05:16 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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