簡體   English   中英

嘗試通過htaccess重定向我的wordpress網站上的所有index.html

[英]Trying to redirect all index.html on my wordpress site through my htaccess

我正在嘗試完全像我的index.php規則一樣剝離所有index.html文件和擴展名。 意思是代替

www.discretix/modules-hdcp/index.html

應該有

www.discretix/modules-hdcp/

它適用於index.php但不適用於index.html 我正在使用wordpress,而我的服務器是apache。

這些是我的htaccess規則:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~discretix/
RewriteRule ^index\.php$ - [L]
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~discretix/index.php [L]
</IfModule>

以下規則將使用301重定向(永久移動)將用戶從index.html或index.php重定向到文件夾(這將反映在客戶端瀏覽器地址欄中),您可能希望將其更改為302重定向(最初是臨時重定向,但由於未指定的原因,現在通常用於指定重定向)

RewriteBase /~discretix/
RewriteRule ^index\.(html|php)$ ./ [R=301,L]

暫無
暫無

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

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