Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Pretty URLs not working

  •  04-28-2008, 4:22 AM

    Pretty URLs not working

    Hello, I'm totally new to using RegEx, but was able to successfully implement some "pretty urls" rewriting (http://www.roscripts.com/Pretty_URLs_-_a_guide_to_URL_rewriting-168.html) using RegEx.  But on another section of my website, eh...not so successful.

     

    I've got a section on my site that connects to a database to pull up some info on some projects.  So for example, one page might look like this:

    http://charlesrubinoff.com/work/?type=print&Id=optimism

    where the variables TYPE and ID are in the url to pull up the appropriate resulting info.   So, the mod_rewrite stuff I put into the .htaccess is as follows:

    RewriteEngine on
    RewriteRule ^([^/\.]+)/?([^/\.]+)*/?$ index.php?type=$1&id=$2[NC,L]


    so, for the example above, i should be able to enter http://charlesrubinoff.com/work/print/optimism and it'd pull  up the same page as http://charlesrubinoff.com/work/?type=print&Id=optimism, right?  well, it does.... kind of.

    the first variable (type) and second (id) will always be some text strings, possibly involving numbers.  i admit, the rewriterule i have above is based on a google search, not me fully understanding how to write regex. 

     

    a page comes up, but the images and project-specific info doesn't show.  the images linked to the database don't show, but also just a static image i have on that particular index.php doesn't show.    and if i just use the first variable, say http://charlesrubinoff.com/work/print, that works but not when i add the second, as in http://charlesrubinoff.com/work/print/optimism

    i think it's just a matter of me coding the regex wrong, but hmm..... any ideas?

    the above regex i'm using in another section (the About section on my site) and it works perfectly.   

    Filed under: , ,
View Complete Thread