Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.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 使用Codeigniter暂时关闭站点(301可能使用routes.php?)_.htaccess_Codeigniter_Mod Rewrite_Redirect_Seo - Fatal编程技术网

.htaccess 使用Codeigniter暂时关闭站点(301可能使用routes.php?)

.htaccess 使用Codeigniter暂时关闭站点(301可能使用routes.php?),.htaccess,codeigniter,mod-rewrite,redirect,seo,.htaccess,Codeigniter,Mod Rewrite,Redirect,Seo,我将Codeigniter与标准的.htaccess重写规则一起使用,以便在URL中看不到/index.php/ 现在,我最近需要暂时关闭该网站,因此希望将所有人重定向到“关闭”页面。以下方面发挥了作用: $route['default_controller'] = "down"; $route['(:any)'] = "down"; 但我知道在这种情况下,301是非常合适的 我应该如何设置,在哪里设置?我没有看到在routes.php中指定它的方法,并且由于现有的规则,我对如何在.htacc

我将Codeigniter与标准的.htaccess重写规则一起使用,以便在URL中看不到/index.php/

现在,我最近需要暂时关闭该网站,因此希望将所有人重定向到“关闭”页面。以下方面发挥了作用:

$route['default_controller'] = "down";
$route['(:any)'] = "down";
但我知道在这种情况下,301是非常合适的

我应该如何设置,在哪里设置?我没有看到在routes.php中指定它的方法,并且由于现有的规则,我对如何在.htaccess中指定它感到困惑

RewriteBase /

RewriteCond %{REQUEST_URI} ^_system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^myapp.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !^(index\.php|resources|files|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 

你不需要301重定向。301表示“永久”,这应该只是一个临时重定向。如果您将此添加到所有其他规则之上,则可以使用htaccess执行此操作:

RewriteRule ^ /down.html [L,R=302]
只要它高于任何其他规则,那么任何请求都将被重定向到
/down.html
。如果您不想从外部重定向浏览器(例如,在URL地址栏中显示
/down.html
URL),请从方括号中删除
,R=302
位,并且当所提供的内容来自down.html时,URL地址栏将保持不变