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 Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Asheeown Posted February 19, 2007 Share Posted February 19, 2007 Yes restate the question Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.