[英]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.