mattal999 Posted January 9, 2010 Share Posted January 9, 2010 Hi, I have this rule: rewriteRule ^download/([0-9]+)$ download.php?id=$1 [L] Which works on my production server, but not on the local server. The mod_rewrite module is enabled in the httpd.conf and AllowOverride is set to All on the folders. Basically, a URL like download/52 just writes as download.php?id= and the id is not passed. Any ideas? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 9, 2010 Share Posted January 9, 2010 How do you know that the id is not passed? What is your php code in download.php? Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991696 Share on other sites More sharing options...
mattal999 Posted January 9, 2010 Author Share Posted January 9, 2010 I have tried using this at the top: print_r($_GET); And it returns: Array ( ) Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991875 Share on other sites More sharing options...
wildteen88 Posted January 9, 2010 Share Posted January 9, 2010 What was the exact url you used? Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991890 Share on other sites More sharing options...
mattal999 Posted January 9, 2010 Author Share Posted January 9, 2010 http://new.localhost/download/52 The script is located in 'new/' and is called 'download.php' I have a htaccess that rewrites the directory 'new/' to 'http://new.localhost/': rewriteCond %{HTTP_HOST} new.localhost rewriteCond %{REQUEST_URI} !new/ rewriteRule ^(.*)$ new/$1 [L] To make this work, I added this line in the windows hosts file: 127.0.0.1 new.localhost And I can access the site at 'http://new.localhost/' fine. Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991903 Share on other sites More sharing options...
wildteen88 Posted January 9, 2010 Share Posted January 9, 2010 In what file is this code located? rewriteRule ^download/([0-9]+)$ download.php?id=$1 [L] Placing that code in a .htaccess file within the new/ folder should work. Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991929 Share on other sites More sharing options...
mattal999 Posted January 9, 2010 Author Share Posted January 9, 2010 Yeah thats where it is. I also have the same problem with my search.php rewrite rule: It doesn't pass the variables. The URL used is 'search/123' and it is meant to call 'search.php?q=123' and it is only calling 'search.php?q='. Strange thing is, I tried deleting the entire .htaccess file and if I try going to 'search/123' it STILL returns the search.php page. EVEN after clearing my cache and trying a different browser. I am rather confused. Quote Link to comment https://forums.phpfreaks.com/topic/187824-variables-are-not-passed-on-local-server-but-work-on-production-server/#findComment-991935 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.