Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 将.html重定向到非html页面wordpress_.htaccess_Redirect_Http Status Code 301 - Fatal编程技术网

.htaccess 将.html重定向到非html页面wordpress

.htaccess 将.html重定向到非html页面wordpress,.htaccess,redirect,http-status-code-301,.htaccess,Redirect,Http Status Code 301,我有一个旧的html网站,它有.html页面,我想重定向到wordpress有的非.html页面 例如 旧址 wordpress网站 有很多网页在网站上,所以这是可能的做到这一点与一个规则 我尝试使用一个规则,但它打破了上传文件夹的一些图像,显示404 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENA

我有一个旧的html网站,它有.html页面,我想重定向到wordpress有的非.html页面

例如

旧址

wordpress网站

有很多网页在网站上,所以这是可能的做到这一点与一个规则

我尝试使用一个规则,但它打破了上传文件夹的一些图像,显示404

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
RewriteRule . /index.php [L]
</IfModule>

重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)\.html$/$1[L,R=301]
重写规则/index.php[L]

在另一条规则(
RewriteRule
)及其关联条件(
RewriteCond
)之间插入新规则会破坏另一条规则

因此,当您将规则移到开头或结尾时,它应该按原样工作

一个小挑剔,永远不要测试!当一切正常工作时,您可以将
R
替换为
R=301
()