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
Php htaccess replace"_&引用;加上-&引用;_Php_.htaccess - Fatal编程技术网

Php htaccess replace"_&引用;加上-&引用;

Php htaccess replace"_&引用;加上-&引用;,php,.htaccess,Php,.htaccess,这是我的htaccess,它从URL中隐藏?m RewriteEngine On <IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]*)$ index.php?m=$1 [QSA,L] </IfModule> 重新编写引擎打开 重写cond%{REQUEST_FILENAME}

这是我的
htaccess
,它从URL中隐藏
?m

RewriteEngine On

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^.]*)$ index.php?m=$1 [QSA,L]
</IfModule>
重新编写引擎打开
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^([^.]*)$index.php?m=$1[QSA,L]

$1
的一个例子可能是
my_profile
。现在我希望用户将其视为
my profile
,但在
PHP
中,
$\u GET['m']
的值仍然应该是
my\u profile
。我该怎么做呢?

好的,如果我正确地收到您的请求,那么您正在呼叫:
mydomain.com/my profile
,那么以下操作将起作用:

RewriteEngine On

RewriteRule ^([^-]*)-([^-]*-.*) $1_$2 [N]
RewriteRule ^([^-]*)-([^-]*)$ index.php?m=$1_$2 [L]

我的非常花哨的个人资料
这样的东西必须工作吗?如果它是
我的非常花哨的个人资料
给用户,它应该像
我的非常花哨的个人资料
那样显示,但是在
PHP
中,它仍然应该是
my_extrement-fancy_profile
。那么我建议您让用户调用
my extrement-fancy profile
并在PHP中替换它:
$getM=str_replace('-','''''''.$GET[/m'])
是的,我知道我可以在PHP中这样做,但是如何在
htaccess
中用“-”替换“uux”?它是否按预期工作?是的,它工作正常,但实际上我是按照您在评论中建议的方式来做的。链接是
my profile
,我在PHP中将所有“-”替换为“\ux”。