【发布时间】:2020-09-06 23:48:09
【问题描述】:
尝试使用@anubhava 的solution 在我们的covid-19 dashboard 中显示quarantine.country/coronavirus/dashboard/usa/ 而不是quarantine.country/coronavirus/dashboard/region/usa/(美国):
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /coronavirus/dashboard/
RewriteRule ^region/(.*)$ /$1 [L,NC,R]
- 请告诉我为什么上面的解决方案似乎没有所需的重写。谢谢!
【问题讨论】:
-
我的 URL 类似于
https://www.test.com/something/en/home。我的代码在目录something中,但我需要从 URL 中删除它。所以 URL 应该是https://www.test.com/en/home。我用RewriteBase /尝试了上述规则,但它不起作用@yatko
标签: regex apache .htaccess mod-rewrite subdirectory