.htaccess URL重写(从URL删除文件夹)

矢子

尝试使用@anubhava解决方案quarantine.country/coronavirus/dashboard/usa/而不是quarantine.country/coronavirus/dashboard/region/usa/在我们的covid-19美国仪表板上展示

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /coronavirus/dashboard/

RewriteRule ^region/(.*)$ /$1 [L,NC,R]
  • 请让我知道为什么上述解决方案似乎具有所需的重写。谢谢!
阿努巴瓦

您可以在以下规则中使用这些规则/coronavirus/dashboard/.htaccess

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /coronavirus/dashboard/

RewriteRule ^(?!region/).*$ region/$0 [L,NC]

这将使您将URL用作: https://quarantine.country/coronavirus/dashboard/usa/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章