htaccess redirection

前端 未结 7 1692
自闭症患者
自闭症患者 2020-12-20 19:16

I have a domain test.com

Now i have the latest files in test.com/backup/

Now , what i need is, when i type test.com

相关标签:
7条回答
  • 2020-12-20 19:35

    In index.php,

    header('Location: /backup/');
    exit;

    0 讨论(0)
  • 2020-12-20 19:40

    Add this to your htaccess file:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.test\.com$
    RewriteRule ^$ http://www.test.com/backup/ [L,R=301]
    
    0 讨论(0)
  • 2020-12-20 19:41

    If you want it to be silent:

    RewriteEngine on
    RewriteRule ^(.*)$ /backup/$1 [L,NC]
    

    This will make http://test.com/ appear to contain the files inside /backup/ without having backup in the url

    0 讨论(0)
  • 2020-12-20 19:41

    In your .htaccess file put:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^test\.com$
    RewriteRule (.*) http://www.test.com/$1 [R=301,L]
    RewriteRule ^$ backup [L]
    
    0 讨论(0)
  • 2020-12-20 19:41

    Add this to your .htaccess

    RewriteRule ^(.*)$ http://www.test.com/backup/ [QSA,L]
    
    0 讨论(0)
  • 2020-12-20 19:42

    in your .htaccess file:

    Redirect 301 / /backup

    0 讨论(0)
提交回复
热议问题