RewriteRule for myspace style directories

Discussion in 'Apache' started by Carlamo, Jul 18, 2007.

  1. #1
    Hi all

    I am currently trying to write a .htaccess file which will allow me to have say:

    www.domain.com/hello redirect to say www.domain.com/profile.html?id=hello&
    however the "hello" part can be anything, just like how myspace works with profiles. so for example www.myspace.com/someonesprofile redirects to some other page which then get the info from the database etc...

    Here is what i have so far:

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9]+)$ /$1/ [R]
    RewriteRule ^([A-Za-z0-9]+)/$ /index.html?prodID=$1
    RewriteRule ^([A-Za-z0-9]+)/index.html$ /index.html?prodID=$1

    Now this does redirect www.domain.com/hello and www.domain.com/hello/index.html to my desired page however this page does not map correctly to some folders it needs to access such as www.domain.com/assetts/whatever.jpg
    Without changing the code then for this page, can i get this page to still access the required folders? Plus is this the best way to solve this problem?

    I was going to add lines such as:
    RewriteRule ^([A-Za-z0-9]+)/style/style.css$ /style/style.css
    so the page can access such folders however i would need to do this for every file etc...

    Any help would be great ;)
     
    Carlamo, Jul 18, 2007 IP