How to setup a redirection from root domain name to a sub folder?

Maxoq

Well-known member
Joined
Feb 25, 2015
Messages
384
Best answers
0
Ratings
52 1
Points
28
#1
Hi there,

How can I setup a redirection from root domain name to a sub folder?

For example:
when a visitor enter my website at example.com it will be redirected to example.com/blog/

At this time, I have not got a homepage hence I would like to run a blog first, and it will currectly use as homepage of my website. When I have a homepage, I can remove this redirection and run homepage and blog as separated pages.

Thanks
 

VirtuBox

Global Mod
Staff Member
Joined
May 3, 2016
Messages
1,604
Best answers
4
Ratings
447 13
Points
83
#2
Hello,
with Plesk, you can set the following code in Apache & Nginx settings > Additional Nginx directives

NGINX:
location =/ {
    return 302 https://$host/blog/;
}
You can also use a 301 redirection instead of the 302 in my example, but if it's a temporary redirection, I think a 302 is enough.
 
Joined
Apr 18, 2017
Messages
46
Best answers
1
Ratings
13 1
Points
8
#7
Hi, @Maxoq!
301 HTTP-status means that your website is permanently moved from the requested URL to a new one while the web page weight of the old page is transferred to the new one.
Redirect 302 does not convey the page weight of the donor to the acceptor. It is better to use 303 and 307 redirects for temporary redirection. This is due to incorrect processing of the status 302 in some browsers.
You can set up a temporary redirect using Apache or Nginx.
You can do it manually or using some online tools which you can use to generate htaccess rules, for example, https://www.aleydasolis.com/htaccess-redirects-generator/.
Also, you can convert Apache's to nginx configuration with https://winginx.com/en/htaccess if it is needed. HTH
 
Latest Threads
Replies
0
Views
1
Replies
1
Views
58
Replies
0
Views
1
Replies
0
Views
37
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
Recommended Threads
Replies
7
Views
1,786
Replies
1
Views
1,810
Replies
6
Views
1,246

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top