简体   繁体   中英

.htaccess - how to redirect from root to subfolder?

I have a website with URL www.somedomain.com

I want to redirect to a subfolder "folder", so that when you enter the website you are automatically redirected to www.somedomain.com/subfolder.

But I do not want the root directory to be changed, just simple redirection.

Is this possible with .htaccess ?

Is it possible to hide the /subfolder part from the URL also ?

Thanks

You can use a rewrite rule that uses ^$ to represent the root and rewrite that to your /store directory, like this:

RewriteEngine On RewriteRule ^$ /store [L]

Just replace store with your directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM