Forum Moderators: phranque

Message Too Old, No Replies

htaccess link matching

         

lo_baan

9:49 am on Apr 3, 2007 (gmt 0)

10+ Year Member



I am facing some problem with matching URL, for instance some URLs are wrongly accessible when one inserts any characters in between url.

Example:

http://www.example.com/welcome.php is also accesible when opened with URL
http://www.example.com/anycharacter/welcome.php

Can somone please explain why this is happening? And is there a way to stop this?

Lo

jdMorgan

2:03 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check to see if mod_negotiation is enabled (with Options MultiViews) or if AcceptPathInfo is enabled (Apache 2.x only).

Otherwise, this might be the result of pre-existing internal rewrites (mod_rewrite) or redirects (mod_rewrite or mod_alias), or a script.

Jim

lo_baan

4:17 pm on Apr 3, 2007 (gmt 0)

10+ Year Member



Hey JD,

Thanks for your reply, you are right mod_negotiation is enabled on httpd. I dont have access to httpd.conf since this is a shared hosting server.

Is there a way to disable it from htaccess file?

Lo

jdMorgan

4:49 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, using the "Options" directive. See Apache core [httpd.apache.org] documentation.

Jim

lo_baan

3:52 am on Apr 5, 2007 (gmt 0)

10+ Year Member



I have tried working around with "Options", but it doesnt seem to give the expected result.

This is what i have set.

Options +FollowSymlinks
Options -MultiViews
AcceptPathInfo Off
RewriteEngine On

Is there anything else that has to be done?

Lo

jdMorgan

5:04 am on Apr 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using RewriteRules, then look into the term "anchoring" in the regular-expressions tutorial cited in our forum charter [webmasterworld.com]. It is possible that your URL-matching patterns are unanchored or incorrect.

Also, you may use


Options +FollowSymLinks -MultiViews

all on one line, instead of using two lines.

Jim