Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
.htaccess htaccess重写规则以转发特定文件夹_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess htaccess重写规则以转发特定文件夹

.htaccess htaccess重写规则以转发特定文件夹,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我需要关于.htaccess正则表达式的帮助。我想把这个url:www.aloha.com/foo/bar/sample.html转发到www/aloha/foo/bar/index.php?go=sample 我试着用 重写规则/foo/bar/^(.*).html/foo/bar/index.php?go=$1[L] 但它不起作用 我也已经有了另一个与此规则冲突的重写规则。这就是为什么我需要为这个特定文件夹创建另一个规则 重写规则^(.*).html index.php?输入=$1[L] 你

我需要关于.htaccess正则表达式的帮助。我想把这个url:
www.aloha.com/foo/bar/sample.html
转发到
www/aloha/foo/bar/index.php?go=sample

我试着用

重写规则/foo/bar/^(.*).html/foo/bar/index.php?go=$1[L]

但它不起作用

我也已经有了另一个与此规则冲突的重写规则。这就是为什么我需要为这个特定文件夹创建另一个规则

重写规则^(.*).html index.php?输入=$1[L]

你的一些语法不合适。例如,
^
表示字符类的开始或否定。另外,我假设您需要一个文件名,所以不要使用可选的捕获

最后,我使捕获不贪婪。我鼓励你更进一步,更具体地抓捕

例如:

RewriteRule ^foo/bar/([^/]+)\.html$ /foo/bar/index.php?go=$1 [L]
你的一些语法不合适。例如,
^
表示字符类的开始或否定。另外,我假设您需要一个文件名,所以不要使用可选的捕获

最后,我使捕获不贪婪。我鼓励你更进一步,更具体地抓捕

例如:

RewriteRule ^foo/bar/([^/]+)\.html$ /foo/bar/index.php?go=$1 [L]

尝试删除两侧的初始斜线删除两侧的初始斜线