spadin Posted August 10, 2005 Posted August 10, 2005 Hi, I'm trying to make a rule on an .htaccess file, but for some reason the rule is not working. First the rule is: >RewriteEngine On RewriteRule ^test/(.*)/(.*).php /test.php?var1=$1&var2=$2 The script is called test.php and it is: ><?php echo "var1 is: "; echo $_GET['var1']; echo "<br />"; echo "var2 is: "; echo $_GET['var2']; ?> I chmod the .htaccess to 644 (-rw-r--r--) because some tutorial on the web suggested it. The .htaccess file is in a subdirectory. Does it have to be in the home directory? The htaccess file and the test.php and in the same directory and when I call the the file I call it relative to where the .htaccess file is. I'm confused. Can anyone help? Thanks, Sandro Quote
spadin Posted August 10, 2005 Author Posted August 10, 2005 Ok, so I got it to work by changing the directory and adding [R] to the end, but now the url changes to the old format. I would like the url to stay like /test/thisis/atest.php instead of /test.php?var1=thisis&var2=atest >RewriteEngine On RewriteRule ^test/(.*)/(.*).php /polidiggs/testbed/test.php?var1=$1&var2=$2 [R] Quote
spadin Posted August 10, 2005 Author Posted August 10, 2005 Sometimes you figure things out after you ask people questions. This is one of those times. I needed to add the [L] flag instead of the [R] flag. Sandro Quote
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.