关于系统
我的项目中有这种格式的URL: -
http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0
Run Code Online (Sandbox Code Playgroud)
其中关键字/类对意味着使用"class"关键字进行搜索.
我有一个常见的index.php文件,它为项目中的每个模块执行.只有一个重写规则可以从URL中删除index.php: -
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
Run Code Online (Sandbox Code Playgroud)
我在阅读搜索URL时准备搜索URL和urldecode()时使用urlencode().
问题
只有正斜杠字符会破坏导致404页面未找到错误的URL.例如,如果我搜索one/twoURL是
http://project_name/browse_by_exam/type/tutor_search/keyword/one%2Ftwo/new_search/1/search_exam/0/search_subject/0/page_sort/
Run Code Online (Sandbox Code Playgroud)
我该如何解决?我需要将index.php隐藏在URL中.否则,如果不需要,那么正斜杠就没有问题了,我可以使用这个URL: -
http://project_name/index.php?browse_by_exam/type/tutor_search/keyword/one
%2Ftwo/new_search/1/search_exam/0/search_subject/0
Run Code Online (Sandbox Code Playgroud) 我需要将/作为变量作为URL的一部分传递.
我的结构如下:www.domain.com/listings/page-1/city-Burnaby+South/type-Townhome/bedroom-2/bathroom-2
在这种情况下,它最终归结为listing.php,除此之外的所有内容都成为我的PHP脚本使用$ _SERVER ['REQUEST_URI'] var解析的参数.
但是,当生成URL时,当其中一个变量变为"公寓/公寓"并且/通过urlencode()在PHP中变为%2F时,整个事情会窒息并且我得到"未找到"错误.
如何通过/不破坏URL?我错过了什么?我认为这些urlencode()字符(%2F,%20等)的重点是逃避这些问题.
我有IIS(Microsoft-IIS/7.5)返回403禁止,我无法弄清楚为什么.我把它缩小到了,%2F但只有当它前面有一个字母时.知道是什么原因引起的吗?
这些工作......
但是如果你把任何一个字母放在%2F它前面那就失败了403.
这些失败......
谢谢!
更新:我排除了ColdFusion,因为这给出了相同的403:http://example.com/mySite123/indexdotcfm? x = a%2F
更新:
Top Level IIs:
Checked:
Allow unlisted file name extensions
Allow unlisted verbs
Allow high-bit characters
Unchecked:
Allow double escaping
Request Limits:
Maximum allowed content length (Bytes): 30000000 Maximum URL length (Bytes):
4096 Maximum query string (Bytes): 2048
Sites
mySite123:
Checked:
Allow unlisted verbs
Allow high-bit characters
Unchecked:
Allow unlisted file name …Run Code Online (Sandbox Code Playgroud)