![](/img/trans.png)
[英]How can I remove this directory/folder from url with htaccess rewrite?
[英].htaccess URL rewrite (remove folder from URL)
嘗試使用@anubhava的解決方案在我們的covid-19 儀表板中顯示quarantine.country/coronavirus/dashboard/usa/
區.country/coronavirus/dashboard/usa/ 而不是quarantine.country/coronavirus/dashboard/region/usa/
.country/coronavirus/dashboard/region/usa/:
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/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.