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.

 

Link to comment
Share on other sites

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...

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.