![](/img/trans.png)
[英]apache .htaccess file https:// redirect -— rewrite it for subdirectory?
[英]Apache Rewrite URL in .htaccess File: Remove Subdirectory
如何使用.htaccess文件中的重寫規則從URL中刪除文件夾?
代替:
http://www.example.com/city/houston/
要么:
http://www.example.com/city/chicago/
該網址將顯示為:
http://www.example.com/houston/
要么
http://www.example.com/chicago/
謝謝你的幫助!
在您的Root / .htaccess中嘗試一下
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/?$ /city/$1 [NC,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.