ohdang888 Posted January 3, 2011 Share Posted January 3, 2011 ok so i have set up wildcard subdomains on my VPS, and this current mod_rewrite code is working great. EXCEPT: say i have this url: http://test.domain.com/current/path I want that to go to index.php?siteName=test&request=/current/path right now, what i'm getting (i know this by print_r($_GET)), is siteName=test (works great), but request=index.php Whats wrong here? Any help is greatly appreciated, Thanks <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC] RewriteRule (.*) index.php?siteName=%2&request=$1 [L] </IfModule> Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/ Share on other sites More sharing options...
johnny86 Posted January 3, 2011 Share Posted January 3, 2011 What about changing RewriteRule (.*) index.php?siteName=%2&request=$1 [L] to RewriteRule (index\.php)?(.*) index.php?siteName=%2&request=$2 [L] Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154179 Share on other sites More sharing options...
ohdang888 Posted January 3, 2011 Author Share Posted January 3, 2011 What about changing RewriteRule (.*) index.php?siteName=%2&request=$1 [L] to RewriteRule (index\.php)?(.*) index.php?siteName=%2&request=$2 [L] Now request is empty, no matter what path i put after domain.com Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154291 Share on other sites More sharing options...
johnny86 Posted January 3, 2011 Share Posted January 3, 2011 How about: RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com(.*) [NC] RewriteRule .* index.php?siteName=%2&request=%3 [L] Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154308 Share on other sites More sharing options...
ohdang888 Posted January 3, 2011 Author Share Posted January 3, 2011 How about: RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com(.*) [NC] RewriteRule .* index.php?siteName=%2&request=%3 [L] http://testing.domain.com No it outright fails to do anything... Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154328 Share on other sites More sharing options...
ohdang888 Posted January 3, 2011 Author Share Posted January 3, 2011 I tried RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com([.]*) [NC] RewriteRule .* index.php?siteName=%2&request=%3 [L] and still outright not working... gah! Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154334 Share on other sites More sharing options...
ohdang888 Posted January 4, 2011 Author Share Posted January 4, 2011 gah why is this so difficult! Link to comment https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/#findComment-1154849 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.