开发者

search.php will stack and show multiple times

开发者 https://www.devze.com 2023-02-23 18:33 出处:网络
my site is a search engine and and if you type in search.php with the forward slashes it will show results the same as the regular url. for example:

my site is a search engine and and if you type in search.php with the forward slashes it will show results the same as the regular url. for example:

regular url: http://domain.com/search.php?query=keyword&select=all

stacking url: http://domain.com/search.php/search.php?query=keyword&select=all

http://domain开发者_如何学运维.com/search.php/search.php/search.php?query=keyword&select=all

I can literally keep adding search.php/ and it will always work. How can I make it only work when the regular url is used? .htaccess maybe?

Another thing is my search.php is in the root directory and not in a "search" subfolder. Anyone have any ideas?

EDIT: Also if anyone else ever sees this and is having the same problem. I added AcceptPathInfo Off to my .htaccess and it seemed to fix it.


It's not 'stacking' as such, but PATH_INFO is coming into play. /search.php/anything-you like will execute search.php, and pass anything-you-like as the PATH_INFO value. Take a look at disabling it in apache.

Alternatively, you could redirect search.php if it has a non-null value for $_SERVER['PATH_INFO']

If you're accessing /search.php/ and your form submits to "search.php", I believe you'll see this behaviour. You should probably change the form's action to /search.php, if this is the cause.


in you search box remove the search.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号