繁体   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