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 in browser it should go to test.com/backup/
How can i write code for that in htaccess file
Using Redirect in an .htaccess file enables you to redirect users from an old page to a new page without having to keep the old page. For example, if you use index.html as your index file and then later rename index.html to home.html, you could set up a redirect to send users from index.html to home.html.
The . Because the WordPress 301 redirect is not always reliable, we recommend issuing the 301 redirect via your . htaccess file. Another benefit is that the . htaccess redirect is slightly faster than redirecting via PHP, because it is loaded even before the rest of the page.
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
in your .htaccess file:
Redirect 301 / /backup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With