簡體   English   中英

防止通過索引訪問頁面。php

[英]Prevent to access to page by index.php

我在我的網站中使用干凈的 URL,並且我想阻止用戶在 URL 中寫入 index.php 時訪問我的頁面! 我的表單中也有index.php具有 POST 方法!

有什么辦法可以使用這樣的東西:

RewriteCond %{REQUEST_METHOD}  = GET [AND] %{SCRIPT_FILENAME} = index.php
Redirect 301 / http://example.com/

這段代碼正確嗎?

編輯

我使用它,但它似乎陷入無限循環!

RewriteCond %{REQUEST_METHOD}  ^GET$ 
RewriteCond %{SCRIPT_FILENAME} ^index.php
Redirect 301 / http://www.XXXXXXXXX.net/

這應該有效:

RewriteCond %{REQUEST_METHOD}  ^GET$
RewriteCond %{SCRIPT_FILENAME} ^index\.php
RewriteRule ^(.*)$ http://XXXXX.COM/ [R=301]

暫無
暫無

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

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