Jump to content

[SOLVED] "Multiple Choices" are frustrating my rewrite


Helmet

Recommended Posts

After a couple of hours of looking for a solution and trying different rules, I've come to the conclusion that there's something outside of mod_rewrite causing this problem. I thought I'd found the solution when someone in another thread was talking about turning off multiviews, but I've done that to no avail. If it matters, I'm with 1&1.

 

I'm looking to change:

http://example.com/variable-directory-name/file.php?id=integer

 

to

http://example.com/variable-directory-name/file/integer/

 

and I'm trying to use this to do it:

 

Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/file/(.*)/$ $1/file.php?id=$2 [L]

 

But all I get is:

Multiple Choices

 

The document name you requested (/variable-directory-name/file/integer/) could not be found on this server. However, we found documents with names similar to the one you requested.

Available documents:

 

/variable-directory-name/file.php/integer/ (common basename)

 

The closest I've come to solving this is determining that my mod_rewrite rules seem to be good, because if I'm not getting this I'm getting a 404. Am I missing something simple? Ideally I'd like to be able to place this rewrite in the site's root .htaccess.

 

Or you can try this:

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule file/id/(.*)/ file.php?id=$1

RewriteRule file/id/(.*) file.php?id=$1

 

This will make your url:

 

http://www.example.com/variable-directory-name/file/id/integer/

Ok, I appreciate your help!

I have one htaccess at the root of the site:

 

#password for dev environment
AuthType Basic
AuthName "directory" 
AuthUserFile /path/to/htpasswd
require user helmet

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /errordocument.php

 

and then there's the htaccess in question in one of those second level directories

http://example.com/directory/.htaccess.

 

Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/file/(.*)/$ $1/file.php?id=$2 [L]

 

I'm trying to build

 

http://example.com/directory/file/integer/

 

from

 

http://example.com/directory/file.php?id=integer

 

I'm not sure if there's any other information that would be helpful...

 

 

That's good.

 

Now eliminate the second .htaccess.

 

Two, the .htaccess file on the root has rewrite rules, but you will notice that it is not turned on.

 

So let's rewrite it, pardon the pun.

 

#password for dev environment
AuthType Basic
AuthName "directory"
AuthUserFile /path/to/htpasswd
require user helmet

Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteRule file/id/(.*)/ file.php?id=$1
RewriteRule file/id/(.*) file.php?id=$1  

 

If you experience the same thing - switch the -MultiViews to +MultiViews.

 

I also took out

 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /errordocument.php

 

Just for now.

ok, example.com/.htaccess is now:

AuthType Basic
AuthName "directory" 
AuthUserFile /path/to/htpasswd
require user helmet

Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteRule file/id/(.*)/ file.php?id=$1
RewriteRule file/id/(.*) file.php?id=$1 

 

I get the same 300 for

 

example.com/directory/file/integer/

 

and a 404 if I change to +MultiViews

 

incidentally, the errordocument.php lines were working as expected despite not having the line turning the engine on

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.