簡體   English   中英

使用 htaccess 從 url 中刪除文件夾

[英]remove folder from url with htaccess

所以我有一個名為 pages 的文件夾,其中包含我網站的頁面,當打開其中一個文件時,url 會讀取 -

zebrafishweb/pages/contact

我希望它只是閱讀

斑馬魚網/聯系方式

我已經有這個 htaccess 文件來刪除我還想繼續使用的任何.php.html 擴展。 我不知道如何編寫這些 htaccess 文件,只是從 web 復制並為我量身定制!

 RewriteEngine on

 RewriteRule ^(themes|order-now|submissions|faq|contact)$ $1.php [NC,L]
 RewriteRule ^(home|faq)$ $1.html [NC,L]

對於您顯示的示例,請嘗試遵循 .htaccess 規則文件。 確保在測試 URL 之前清除瀏覽器緩存。

RewriteEngine on
RewriteBase /zebrafish/pages/

RewriteRule ^zebrafish/pages/contact/?$ /contact? [R=301,NC,L]

RewriteRule ^(themes|order-now|submissions|faq|contact)$ zebrafish/pages/$1.php [NC,L]
RewriteRule ^(home|faq)$ $1.html [NC,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM