简体   繁体   中英

Apache, HTAccess, rewrite rules

Hope you are fine.

I have a problem, if you can help me.

#My rules (in this order):#

(WORKING:)

RewriteRule ^artists\/(.*[^discographies])\,([0-9]*)\/$ /artists/artist.php?id=$2 [L]

URL: /artists/B/barrington-levy,869/


(WORKING:)

RewriteRule ^artists\/(.*[^discographies])\,([0-9]*)\/discography\/$ /artists/discography.php?id=$2 [L,QSA]

URL: /artists/B/barrington-levy,869/discography/


(WORKING:)

RewriteRule ^artists\/(.*[^discographies])\/$ /artists/alpha.php?id=$1 [L]

URL: /artists/B/


Now i need to make some new rules, and i suck !


The first : /artists/discographies/1979/barrington-levy-shaolin-temple,85/

(NOT WORKING:)

RewriteRule ^artists\/discographies\/([0-9]*)\/(.*)\,[(0-9)*]\/$ /artists/disc.php?id=$4 [L]

The second: /artists/discographies/2009-10/various-artists,jah-shaka-presents-the-positive-message,2563/

(NOT WORKING:)

RewriteRule ^artists\/discographies\/([0-9]*)\-([0-9]*)\/(.*)\,[(0-9)*]\/$ /artists/disc.php?id=$4 [L]

Instead of [(0-9)*] try ([0-9]*)

So for the entire rule replace:

RewriteRule ^artists\/discographies\/([0-9]*)\/(.*)\,[(0-9)*]\/$ /artists/disc.php?id=$4 [L]
RewriteRule ^artists\/discographies\/([0-9]*)\-([0-9]*)\/(.*)\,[(0-9)*]\/$ /artists/disc.php?id=$4 [L]

With:

RewriteRule ^artists\/discographies\/([0-9]*)\/(.*)\,([0-9]*)\/$ /artists/disc.php?id=$3 [L]
RewriteRule ^artists\/discographies\/([0-9]*)\-([0-9]*)\/(.*)\,([0-9]*)\/$ /artists/disc.php?id=$3 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM