I want to do the following: user.domain.com/gallery/galleryname.html ($user and $galleryname) I currently already have the following rewrite rule to rewrite the subdomains but I have no idea on how to rewrite the /gallery/gallername.html part. RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC] RewriteRule ^(.*)$ /path/index.php?user=%1 [QSA,L] Code (markup):
Something like ... RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.com [NC] RewriteRule gallery/(.*?)\.html$ /path/index.php?user=%1&galleryname=$1 [QSA,L] Code (markup): Jay
My first post wasn't that clear sorry what I meant is username.domain.com -> profile.php?user=$1 username.domain.com/gallery/galleryname.html -> gallery.php?user=$1&folder=$2 edit: Ok got it working but it can probably be done a lot easier I think here's how I did it, RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.net$ [NC] RewriteCond %{REQUEST_URI} !^/gallery/([^.]+)\.html$ [NC] RewriteRule ^(.*)? profile.php&username=%1 [QSA,L] RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{REQUEST_URI} ^/gallery/(.*)\.html$ [NC] RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.net$ [NC] RewriteRule ^(gallery/(.+)\.html?)$ gallery.php?username=%1&folder=$2 [QSA,L]