Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 使用HTACCESS的URL中的路径_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Regex 使用HTACCESS的URL中的路径

Regex 使用HTACCESS的URL中的路径,regex,apache,.htaccess,mod-rewrite,Regex,Apache,.htaccess,Mod Rewrite,如何在不改变url的情况下,将url从任何文件重定向到特定的PHP文件并添加为获取路径 例如,如果我尝试进入 www.example.net/this/is/the/path.png 浏览器将向我显示其中的内容 www.example.net/view.php?path=此%2Fis%2Fis%2Fpath.png 您可以在文档\u ROOT/.htaccess文件中使用此代码: 没有视图文件,有view.php,当我重写规则时^?!view.php/*$view.php?path=$1[L,Q

如何在不改变url的情况下,将url从任何文件重定向到特定的PHP文件并添加为获取路径

例如,如果我尝试进入

www.example.net/this/is/the/path.png

浏览器将向我显示其中的内容

www.example.net/view.php?path=此%2Fis%2Fis%2Fpath.png


您可以在文档\u ROOT/.htaccess文件中使用此代码:


没有视图文件,有view.php,当我重写规则时^?!view.php/*$view.php?path=$1[L,QSA],Chrome返回错误代码ERR_TOO_MANY_重定向。
RewriteEngine On
RewriteBase /

RewriteRule ^((?!view).*)$ view?path=$1 [L,QSA,NC]