Michan Posted March 4, 2008 Share Posted March 4, 2008 Hi, I've managed to successfully rewrite subdomains to folders, so that http://username.mysite.com will go to http://mysite.com/user.php?user=username However, I'm having trouble directing extensions of that subdomain to other areas of the site. For example, each user has their own blog and photo gallery, so the following urls should exist: http://username.mysite.com (profile) http://username.mysite.com/blog (blog) http://username.mysite.com/photos (photos) Here is my code: RewriteCond %{HTTP_HOST} !(^\www\b¦^\ftp\b¦^\mail\b¦^\webmail\b).mysite\. RewriteCond %{HTTP_HOST} ^www.([^/]+).mysite.com/blog/?$ [OR] RewriteCond %{HTTP_HOST} ^([^/]+).mysite.com/blog/?$ RewriteRule (.*) blog.php?user=$1 [L] RewriteCond %{HTTP_HOST} !(^\www\b¦^\ftp\b¦^\mail\b¦^\webmail\b).mysite\. RewriteCond $1 !^blog/? RewriteCond %{HTTP_HOST} ^www.([^/]+).mysite.com/?$ [OR] RewriteCond %{HTTP_HOST} ^([^/]+).mysite.com/?$ RewriteRule (.*) user.php?user=%1 [L] As you can see, I've started with the blog, but it just keeps giving me an error every time I try typing the url (although the profile continues to display the page correctly). I've tried searching but couldn't find any success, so any insight/help would be extremely appreciated! Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/94377-rewriting-subdomains-with-subfolders/ Share on other sites More sharing options...
monkeytooth Posted March 24, 2008 Share Posted March 24, 2008 last rewrite rule... RewriteRule (.*) user.php?user=%1 [L] im not 100% familiar with the .htacess file and using it properly, but this could be just me, but I dont ever remember the mention having to use a %.. could be wrong, or could be a typo, just wanted to mention it as something I took notice to. Link to comment https://forums.phpfreaks.com/topic/94377-rewriting-subdomains-with-subfolders/#findComment-499737 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.