blazing Posted February 19, 2007 Share Posted February 19, 2007 Hi, I am having a problem with my .htaccess on my subdomain. Here is my code in the .htaccess RewriteEngine on RewriteRule ^(.*) /home/user/public_html/profile/profile.php?user=$1 RewriteRule ^(.*)/ /home/user/public_html/profile/profile.php?user=$1 Ok, so this code works for stuff in folders like mysite.com/(real folder)forum/(script)"topic/1", on a subdomain or not, but it wont work in the main folder if that makes any sense. So, I have this. my subdomain is profile.mysite.com People view this profile.mysite.com/1 or profile.mysite.com/user/username what happens is, I need the wildcard, and I use in my php script explode to break apart any / so I can make 2 differant variables, also anything more users add like user/username/lol/test/132123123123/123123123, does nothing and shows no error instead if I was to use $1 $2 ok, so I hope that much makes sense, but the problem is on my subdomain, when I go to echo the user=$1, all that comes up is profile.php instead of what people write .com/here/1/1/1/1/1/1 Any ideas of why im only running into this problem on my subdomain, and why its priting the scripts name? Thanks Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/ Share on other sites More sharing options...
Asheeown Posted February 19, 2007 Share Posted February 19, 2007 PHP will not take an integer as a variable name, you must specify a name instead of using a number Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188368 Share on other sites More sharing options...
blazing Posted February 19, 2007 Author Share Posted February 19, 2007 uhm, the variable name is user "profile.php?user=$1", im confused now? It works but when I echo $user it prints, profile.php Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188374 Share on other sites More sharing options...
marcus Posted February 19, 2007 Share Posted February 19, 2007 What's the problem, restate the question, well thought. Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188375 Share on other sites More sharing options...
marcus Posted February 19, 2007 Share Posted February 19, 2007 PHP will not take an integer as a variable name, you must specify a name instead of using a number If you didn't realize that's an .htaccess file. Which variables being reformed into a new stage must be defined by $1 or $1 [L] Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188376 Share on other sites More sharing options...
Asheeown Posted February 19, 2007 Share Posted February 19, 2007 Yes restate the question Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188379 Share on other sites More sharing options...
blazing Posted February 19, 2007 Author Share Posted February 19, 2007 What's the problem, restate the question, well thought. Uhm, I just want to know why when I echo $user it prints "profile.php", instead of the variable in I guess what you can call the query string of profile.mysite.com/"1/", which should be "1/", profile.mysite.com/"user/blazing" being "user/blazing" (I use the explode next to split the / instead of adding extra $2 in .htaccess which create problems for me. Thanks Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188382 Share on other sites More sharing options...
marcus Posted February 19, 2007 Share Posted February 19, 2007 Try adding [L] after the variables in the htaccess, not sure if it would help or not. Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188386 Share on other sites More sharing options...
blazing Posted February 19, 2007 Author Share Posted February 19, 2007 Try adding [L] after the variables in the htaccess, not sure if it would help or not. still only prints the file name instead of the variable Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188389 Share on other sites More sharing options...
blazing Posted February 19, 2007 Author Share Posted February 19, 2007 ok if I add this in the .htaccess file profile.php?user=$1&test=ok echo $user; //prints profile.php echo $test; //prints ok, works just fine for some reason... Link to comment https://forums.phpfreaks.com/topic/39114-htaccess-on-a-subdomain-php/#findComment-188394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.