簡體   English   中英

htaccess:index.php的重定向

[英]htaccess: redirect of index.php

對不起,標題不是很清楚。

我正在使用FatFreeFramework和他的.htaccess:

RewriteCond %{REQUEST_URI} \.ini$
    RewriteRule \.ini$ - [R=404]

    #RewriteCond %{REQUEST_URI} \.html?$
    #RewriteRule \.html?$ - [R=404]

    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php [L,QSA,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

現在,重新設計舊網站,我在谷歌的一些網址編纂成像

www.example.com/index.php?ID=12

我會剝離它並將它們重定向到主頁。

我不知道怎么寫規則,我確實嘗試在這種模式下編輯,但沒有運氣:

RewriteCond %{REQUEST_FILENAME} !-d
    Redirect 301 /index.php?ID=$1 index.php
    RewriteRule .* index.php [L,QSA,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

正好在這個規則之上:

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

添加這個:

RewriteCond %{THE_REQUEST} \ /+index\.php\?ID=[0-9]
RewriteRule ^ / [L,R=301]

您無法使用mod_alias的Redirect指令匹配查詢字符串。

暫無
暫無

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

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