Тёмный

How to Redirect from WWW to Non-WWW on NGINX. Works for Http to Https too! 

DevMarketer
Подписаться 69 тыс.
Просмотров 26 тыс.
50% 1

This tutorial shows you how to redirect www to non-www on Nginx or how to redirect from non-secure to secure ports in Nginx. This can be helpful for many reasons.
This technique is the best for SEO friendly site-wide redirects. All the redirects are 301 permanent redirects, meaning that if someone chooses to link to your site as a www. site it will still go to the right page within the site and it will still pass the link juice onto the real page.
A lot of other great stuff on this channel, be sure to subscribe to see other great tutorials like this one.
==== FOLLOW ME ====
Subscribe for New Releases!
Subscribe to DevMarketer Insider
confirmsubscription.com/h/d/5...
Twitter - / _jacurtis
(ask me questions!)
==== QUESTIONS? ====
Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.
Email me hello@jacurtis.com
Thanks for all your support!
Tags FTW. Nginx redirect from www to no www. Ngnix or Nginx both work. Secure site redirect. Permanent redirect in config configuration file. Help redirect nginx. ssh into server with username and password. Configuration file sites-available help. What do I or How do i?

Хобби

Опубликовано:

 

16 окт 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 51   
@anirudhkrishna9655
@anirudhkrishna9655 6 лет назад
Hit the 100th like, great detailed tutorial, keep making tutorial on nginx, there are not many of them on youtube. Peace.
@predatoreyez
@predatoreyez 2 года назад
Awesome explanation, very simple and clear and yet very helpful and not confusing. Good job
@MauricioMartinez0707
@MauricioMartinez0707 4 года назад
Exactly what I was looking for. Thanks man
@chrismellor7027
@chrismellor7027 6 лет назад
You can also do 'nginx -s reload' which will reload your configurations and not take the site down by restarting nginx. Great videos. Really enjoying them.
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Good tip. THats a more "universal" way to do it. Where as the systemctl method doesn't work on every Unix OS.
@micosair
@micosair 6 лет назад
You`re on fire lately!
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Haha thanks.
@gokhangorkem
@gokhangorkem 6 лет назад
This is great dude. Awesome.
@michaelfarhat4881
@michaelfarhat4881 2 года назад
Saved my day dude. Thanks
@eleftrik
@eleftrik 6 лет назад
Hi, you said that Let's Encrypt certificate is on goblockade.com. But what about www.goblockade.com? "curl -i www.goblockade.com" reports "curl: (51) SSL: no alternative certificate subject name matches target host name", Chrome automatically redirect to goblockade.com, Firefox returns a warning about unsecure connection (correct). How do you usually deal this case? Do you request another SSL certificate for www domain? I think this is an important point. Thank you
@systemicacloud6017
@systemicacloud6017 4 года назад
Thanks very much, worked nice, i tested CentOS Linux release 7.7.1908 (Core) and nginx version: nginx/1.16.1.
@kesitkusumo628
@kesitkusumo628 6 лет назад
Great! Nice Tutorial.
@vhoraayan3372
@vhoraayan3372 5 лет назад
ww program BP picture
@fabiansanchezp
@fabiansanchezp 5 лет назад
Muchas gracias. Me sirvió demasiado.
@apichaidensamut
@apichaidensamut 5 лет назад
Very nice video thanks
@mazenn99
@mazenn99 3 года назад
thank you very much
@EdwinRebolledo
@EdwinRebolledo 4 года назад
Good video!
@skalippanbalippan6972
@skalippanbalippan6972 6 лет назад
Thanks man
@miyukinagara
@miyukinagara Год назад
thx bro for explain, I have a little question about that. if i doing that. is good for seo ?
@robsonscheppercachoeira6721
@robsonscheppercachoeira6721 6 лет назад
Perfect!
@briangichohi594
@briangichohi594 5 лет назад
what font are you using for your terminal?
@rahulak6596
@rahulak6596 3 года назад
thanks bro..
@infinitylooks4556
@infinitylooks4556 6 лет назад
Hey, your videos are very thoughtful and awesome. Do a video on sub domain routing both in development and production, thanks!
@cooldude3010
@cooldude3010 6 лет назад
Seconded. Though I'm pretty sure you can route *.example.com via an C-NAME record to your web app, and in Laravel use Route::domain() to detect and group together subdomain routes. laravel.com/docs/5.5/routing#route-group-sub-domain-routing
@infinitylooks4556
@infinitylooks4556 6 лет назад
A detailed explanation would be better
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Yes that is the basic premise of how you do it. One feature that sucks about Laravel is that you have to hardcode the domain. THis is what makes it confusing for most people. However I have heard rumors that this might be fixed in Laravel 5.6. (cross your fingers).
@spoki89
@spoki89 4 года назад
Man, you're the best!
@trendyfashion9349
@trendyfashion9349 5 лет назад
https enabled and redirecting my http to https but without any greenlock pad what should I do
@bloggervista
@bloggervista 6 лет назад
Thx alex
@maxmininformer6697
@maxmininformer6697 6 лет назад
how to redirect 301 from one domain to another even each post to another post, both hosted on digital ocean with serverpilot.. please send link if video is available..
@mohamedgabr4911
@mohamedgabr4911 6 лет назад
thank you for the video, but how does that happen on your domain hosting? just wondering, does it take any extra configuration on the domain hosting ? thanks!
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Sorry I was trying to show it best I could, but I didnt want to reveal all of my domains and their associated IP addresses. So what you need to do is make an A record that points to the same IP address or server that your Nginx server is on. So in my case, my primary domain is the non-www version. So in order for Nginx to route the www traffic to the non-www you need to make sure the traffic actually gets to the server first. If you don't set up an A record in your DNS then the person who types in your www domain will never reach the server for Nginx to do its magic, because the DNS won't know to pass the traffic off to your server (the user will get a generic browser generated error). Now some DNS providers (any respectable one) allow you to wildcard any subdomain (www is a subdomain) to the same server. That is an option too. I personally don't like wildcarded subdomains unless its a SAAS product that needs them all of the subdomains routed to the server, so I opt to only route the subdomains I want. But to answer your question about what is happening at the domain hosting, I was simply creating an A record for the www subdomain. I sent all for that subdomain to the same server that hosts the non-www version. Once that is set up then the traffic will go to the nginx server and then nginx will route it to the secure port of the non-www version.
@mohamedgabr4911
@mohamedgabr4911 6 лет назад
Thank you so much that you toke the time to answer my question, that means a lot to me. you are the best :)
@SoloTravelBlog
@SoloTravelBlog 2 года назад
File doesn't exist ....
@juanrincon6576
@juanrincon6576 2 месяца назад
Come back Alex!!
@skarnvy8109
@skarnvy8109 6 лет назад
I would be grateful if you could make a video about using & generating dynamic sub-domains with laravel :)
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Good idea, ill add it to the list for future video ideas.
@prasannakumarpulagam
@prasannakumarpulagam 3 года назад
Hi How can i map url in Nginx? for example I want to map the ClouderaManager IP(192.168.0.xx:7180) and port number to Nginx server, How can I do that? can you explain me please.
@DarkWaffle56
@DarkWaffle56 4 года назад
This didn't solve my problem, so hopefully my solution will help others: 1. Go to EC2 panel, and click on Load Balancer tab, and then on your load balancer; 2. Make sure you have 2 listeners: one for HTTP and one for HTTPS (otherwise create those); 3. Edit the rules for each one of them, adding a new rules for each that specifies your (www)(dot)(dot)com to go to port 443 and to be redirected to (dot)com; 4. Having the rules for both HTTP and HTTPS to be redirected to 443 with no "WWW" will be working immediately after that. Hopefully this helped. PS 1: I didn't have sites-available folder in my nginx for my Elastic Beanstalk app EC2. Apart from that, the steps I am saying are much more safer and easier to do. PS 2: Modifications in the EC2 will not be persisted as well since Elastic Beanstalk can instantiate new ones for your app, so keep this in mind.
@icalculi
@icalculi 3 года назад
i am so confused if nginx? load balancers? or route53 cname?
@sireeshasiri8107
@sireeshasiri8107 Год назад
how to convert http to https in hpux
@pequlatv4814
@pequlatv4814 3 года назад
I had 4 courses relating just plain web development, absolutley noone on the whole univeristy wanted to show me how to do this
@cromartie1984
@cromartie1984 6 лет назад
why does it appear in chinese on google search ?
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
What is chinese?
@cromartie1984
@cromartie1984 6 лет назад
chinese characters : en.wikipedia.org/wiki/Chinese_characters
@ergurkha3157
@ergurkha3157 6 лет назад
I can see the nginx version you have installed...
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Is that bad?
@ergurkha3157
@ergurkha3157 6 лет назад
If there a security issue with a specific version, could be... to fix that, in the nginx.conf file, search for "server_tokens off" entry and uncomment it.. that's it
@davidsontechnology4757
@davidsontechnology4757 3 года назад
I bring you blessings from my LORD JESUS CHRIST WHO Is coming again to judge the living and the dead. Please give your life to HIM
@Graf777gos
@Graf777gos 6 лет назад
Do not have redirect www.domain.com to domain.com
@JacurtisTutorials
@JacurtisTutorials 6 лет назад
Why not?
Далее
Configuring subdomains on Nginx
8:14
Просмотров 8 тыс.
How Web Sockets work | Deep Dive
10:22
Просмотров 8 тыс.
NGINX + https 101 The Basics & Getting Started
36:06
Просмотров 51 тыс.
How to Do URL redirects in Wix - WIX SEO Tutorial
5:30
Key Files, Commands, and Directories with NGINX
7:42
What is a Protocol? (Deepdive)
18:14
Просмотров 160 тыс.
Websockets in Laravel: Part 0 - What are Websockets?
14:28
Docker and Nginx Reverse Proxy
31:32
Просмотров 113 тыс.
Using Nginx to Host Multiple Websites on One Server
16:30
УДИВИЛА МЛАДШУЮ СЕСТРУ
0:50
Просмотров 5 млн
The screw cap can also be played like this
0:20
Просмотров 10 млн
ВЕЛОСИПЕД ЗАГОВОРИЛ
0:15
Просмотров 14 млн
Дарю Самокат Скейтеру !
0:42
Просмотров 1,5 млн