mod rewrite unknown folder location

Discussion in 'Programming' started by Silver89, Jan 23, 2010.

  1. #1
    Hi,

    I'm working on a php software that will have the default css in the following location:

    templates/default/css/main.css

    I am using the following mod_rewrite:

    
    RewriteRule ^css/main.css$ template/default/css/main.css [L]
    
    Code (markup):
    But if the user adds new themes then default css location would change because of the folder name, I need to do the equivalent of the following but can't figure out how it should actually be coded?

    Here are two examples I've tried that aern't working
    
    RewriteRule ^css/main.css$ template/([a-zA-Z0-9-_]+)/css/main.css [L]
    
    RewriteRule ^css/main.css$ template/$1/css/main.css [L]
    
    Code (markup):
     
    Silver89, Jan 23, 2010 IP