Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.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
Php 如何使用.htaccess隐藏此url中的第一个变量?_Php_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 如何使用.htaccess隐藏此url中的第一个变量?

Php 如何使用.htaccess隐藏此url中的第一个变量?,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,blah.com/numberVariable/variable2.html 我想在URL中隐藏数字变量 这是我目前的代码: RewriteCond %{QUERY_STRING} action=(.*) RewriteRule ^([1-9][0-9]*)/([-.,_0-9a-zA-z]*)\.html$ details.php query_string=$1&action=%1 [L] RewriteRule ^([1-9][0-9]*)/([-.,_0-9a-zA-z]*)\.

blah.com/numberVariable/variable2.html

我想在URL中隐藏数字变量

这是我目前的代码:

RewriteCond %{QUERY_STRING} action=(.*)
RewriteRule ^([1-9][0-9]*)/([-.,_0-9a-zA-z]*)\.html$  details.php query_string=$1&action=%1 [L]
RewriteRule ^([1-9][0-9]*)/([-.,_0-9a-zA-z]*)\.html$  details.php?query_string=$1 [L]
试试这个正则表达式:

\/[^\/\n]+

解释:

\/           # match the first '/' character
[^\/\n]+     # and anything till the next '/' character or till the line's end
我假设
/numberVariable
是第一个文件夹

希望有帮助。

试试这个正则表达式:

\/[^\/\n]+

解释:

\/           # match the first '/' character
[^\/\n]+     # and anything till the next '/' character or till the line's end
我假设
/numberVariable
是第一个文件夹


希望有帮助。

我能得到一些关于htaccess代码的帮助吗?每当我进行更改时,它就会进入重定向循环。有人能解释一下我的代码是什么意思吗?@neo。嗯,我不是一个
htaccess
专家。但我找到了这个答案:我能得到一些关于htaccess代码的帮助吗?每当我进行更改时,它就会进入重定向循环。有人能解释一下我的代码是什么意思吗?@neo。嗯,我不是一个
htaccess
专家。但我找到了这个答案: