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
专家。但我找到了这个答案: