[英]htaccess redirection
我有一个域test.com
现在我有test.com/backup/中的最新文件
现在,我需要的是,当我在浏览器中键入test.com时 ,它应该转到test.com/backup/
我如何在htaccess文件中编写代码
如果你想让它保持沉默:
RewriteEngine on
RewriteRule ^(.*)$ /backup/$1 [L,NC]
这将使http://test.com/看起来包含/ backup /中的文件,而无需在URL中进行backup
在.htaccess文件中:
重定向301 / /备份
将此添加到.htaccess
RewriteRule ^(.*)$ http://www.test.com/backup/ [QSA,L]
在index.php中,
header('Location: /backup/');
exit;
Assum index.html存在并且是您的directoryindex。
redirectpermanent http://test.com/backup/
在你的.htaccess文件中:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test\.com$
RewriteRule (.*) http://www.test.com/$1 [R=301,L]
RewriteRule ^$ backup [L]
将其添加到您的htaccess文件:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteRule ^$ http://www.test.com/backup/ [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.