.htaccess 如何从URL中删除中间部分-mod_rewrite

.htaccess 如何从URL中删除中间部分-mod_rewrite,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,如何在htaccess文件中将这个url“www.domain.com/index.php?route=custom/static/page”重写为“www.domain.com/page”,基本上只想从url中取出index.php?route=custom/static/page 我不知道正则表达式,所以我试过了,但它只生成 RewriteEngine On RewriteRule ^([^/]*)$ /index.php?route=$1 [L] 这不会从URL中删除“自定义/静态”,我

如何在htaccess文件中将这个url“www.domain.com/index.php?route=custom/static/page”重写为“www.domain.com/page”,基本上只想从url中取出index.php?route=custom/static/page

我不知道正则表达式,所以我试过了,但它只生成

RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?route=$1 [L]

这不会从URL中删除“自定义/静态”,我也尝试了一些其他示例,但只删除index.php?并且不传递变量,任何帮助都将不胜感激

你知道使用mod rewrite的概念吗

在您的问题中,您提到了使用mod rewrite重定向

“www.domain.com/index.php?route=custom/static/page”, 这里
$\u Get['route']=“自定义/静态/页面”
]
$url\u参数=$\u Get['route']

“www.domain.com/page”[此处$_Get['route']=“page”]

因此,现在您可以手动将“custom/static/”添加到所获得的
$\u Get['route']]值中。
作为PHP的
$url\u parameter=“custom/static”+$\u Get['route']//

使用您的mod_rewrite可以满足您的需求

RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?route=$1 [L]
但如果您需要使用.htaccess现成的解决方案,那么我建议您学习“重写引擎”,而不是使用生成工具