mod_rewrite problem

Associate
Joined
30 Dec 2005
Posts
415
Evening all! I've got a bit of a problem with htaccess..

Code:
Options +FollowSymLinks -Indexes
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php

If a user visits http://willesley.org/shop this works fine, as the file doesn't exist so mod_rewrite passes it to /index.php which looks it up in the cms.

The same goes for http://willesley.org/shop?edit which passes 'edit' as a GET variable to /index.php.

http://willesley.org/campsite/ is an empty directory (no index file). Visiting this redirects to /index.php (as it should)

http://willesley.org/campsite/?edit doesn't work - it doesn't pass the GET variable to /index.php. Anyone got any ideas why this is?
 
Associate
Joined
30 Apr 2004
Posts
50
Are you sure the variable isn't being passed?

I've knocked up a quick test page using the htaccess you've provided and used the following as my index.php to check what's being passed in the GET array and it seems to work ok.

PHP:
<html>
	<body>
              // loop through each querystring variable in the $_GET array and echo out each one's variable name ($keyname) and $value.
            <?php
                foreach($_GET as $keyname => $value) {
                   echo("$keyname --&gt; $value.<br />\n");
                } 
             ?>		
	</body>
</html>
 
Back
Top Bottom