.htaccess rewrite for a subdomain problem

Discussion in 'Apache' started by lip9000, Jan 8, 2009.

  1. #1
    I wish to create a rewrite on a subdomain but I'm not sure if I have the code correct. I already have several rewrites on my main domain.

    the subdomain is: blogs.mylol.net

    At the moment the URL to get to the users blog is: blogs.mylol.net/blog.php?id=userid

    I want it to become: blogs.mylol.net/Username

    the file blogs.php is situated in a folder from the root domain called blogs, so blogs.mylol.net points to mylol.net/blogs

    This is what I have at the moment that does not work:

    
    RewriteRule ^blogs\/[^/\.]+\/[a-zA-Z0-9-]+-([0-9]+)(&.+)?$ /blogs/blog.php?id=$1$2 [L]
    
    Code (markup):
    I tried to go to blogs.mylol.net/Username and its giving me a 404 not found. Any ideas?
     
    lip9000, Jan 8, 2009 IP