在IIS或Apache中将不存在的目录作为参数传递
首先看看这个url: 此目录不存在,但stackoverflow可以以某种方式将最后一个目录作为参数传递给他的基本脚本在IIS或Apache中将不存在的目录作为参数传递,apache,iis,mod-rewrite,url-rewriting,isapi-rewrite,Apache,Iis,Mod Rewrite,Url Rewriting,Isapi Rewrite,首先看看这个url: 此目录不存在,但stackoverflow可以以某种方式将最后一个目录作为参数传递给他的基本脚本 是否可以配置IIS或Apache来执行此操作?如何实现?这种行为背后的机制称为url重写,可以在Apache中使用-模块实现,也可以在IIS中使用Helicon(或Helicon提供的非免费替代方案之一)实现IIS 5.1和6或 例如,以下设置将确保在现有文件或目录上无法匹配的每个请求都将传输到index.php文件 mod_rewrite(.htaccess位于文档根目录或
是否可以配置IIS或Apache来执行此操作?如何实现?这种行为背后的机制称为url重写,可以在Apache中使用-模块实现,也可以在IIS中使用Helicon(或Helicon提供的非免费替代方案之一)实现IIS 5.1和6或 例如,以下设置将确保在现有文件或目录上无法匹配的每个请求都将传输到
index.php
文件
mod_rewrite
(.htaccess
位于文档根目录或httpd.conf
中的某个位置)
ISAPI_重写Lite(在IIS设置的相应对话框中)
Microsoft URL重写模块(在文档根目录或配置树中的seomewhere的web.config
中)
这种行为背后的机制称为url重写,可以在Apache中使用-模块实现,也可以在IIS中使用Helicon(或Helicon提供的非免费替代方案之一)实现IIS 5.1和6或 例如,以下设置将确保在现有文件或目录上无法匹配的每个请求都将传输到
index.php
文件
mod_rewrite
(.htaccess
位于文档根目录或httpd.conf
中的某个位置)
ISAPI_重写Lite(在IIS设置的相应对话框中)
Microsoft URL重写模块(在文档根目录或配置树中的seomewhere的web.config
中)
当我点击该链接时,我只得到页眉,没有内容。不,你可以在右边看到:0个问题标记。因此,看到该页面意味着这个不存在的目录正在处理一些问题。当我点击该链接时,我只得到页眉,没有内容。没有。您可以在右侧看到:0个问题标记。因此,看到该页面意味着该不存在的目录正在以某种方式处理
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR] // IF is file (with size > 0)
RewriteCond %{REQUEST_FILENAME} -l [OR] // OR is symbolic link
RewriteCond %{REQUEST_FILENAME} -d // OR is directory
RewriteRule ^.*$ - [NC,L] // DO NOTHING
RewriteRule ^.*$ index.php [NC,L] // TRANSFER TO index.php
// uses same syntax as mod_rewrite
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="MatchExistingFiles" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="RemapMVC" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAll" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>