Forum Moderators: phranque

Message Too Old, No Replies

.htaccess rewriting problem

request for /index/whatever poses problem

         

bensor

6:38 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Hi,

My .htacess seems to be working in every cases excepted when I put "index/index" in the URL. Indeed, when I call $_SERVER['REQUEST_URI']" from PHP with a URL other than "basesite/dir/index/index", everything after "basesite/dir" is returned, but with "/index/index" it returns "basesite/dir/index/index" and eventually everything after.

Per example, I type "localhost/~dirperso/test/contact/view/id/1". It will return "/contact/view/id/1".

But when it is "localhost/~dirperso/test/index/index/style/1", the var returns "/~dirperso/test/index/index/style/1".

My .htaccess file is like this :

RewriteEngine on
RewriteBase /~dirperso/test
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule!\.(js¦ico¦gif¦jpg¦png¦css)$ index.php

It is in the "test" directory.

Has someone a solution to propose?

Thanks.

bensor

11:52 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Some news. I tested again and the problem is in the first part of the URL /index/index . I've just tried with /index/meow and it bugs too.

jdMorgan

5:40 am on Dec 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't see anything wrong on the face of it. Have you disabled MultiViews?

Options -MultiViews

Sometimes, this can interfere with mod_rewrite.

Jim

bensor

9:05 am on Dec 23, 2006 (gmt 0)

10+ Year Member



I've just added your line in my file (I tried before the RewriteRule and at the begining of the file), the browser returns an Internal Server Error (500) :(

EDIT : Oh, I've just read somewhere that the server may try to bypass the .htaccess by trying to call the file related to the first keyword. Can it be related?

EDIt 2 : I've just created a file called "inde.php". I tried to call the URL "/~dirperso/test/inde/whatever". If the .htaccess worked normally, the $_SERVER['REQUEST_URI'] should have been returned. But nothing was returned, as if "inde.php" was called instead of "index.php". Then I deleted it, refreshed the browser and the var returned something.

bensor

12:53 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



Problem solved : in the apache conf file, "AllowOverride" was not configured so that existing files could be ignored for keywords which were the same as them

jdMorgan

3:34 pm on Dec 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What was the AllowOverride setting when you had trouble?
What did you change the AllowOverride setting to?

The answer may help others with the same problem...

Thanks,
Jim