
3 ways to implement domain name jump to www including https using 301
Have deep obsessive-compulsive disorder
Just like domain name with www
Without www, I feel uncomfortable. . . .
The first is to use a .htaccess file to implement the jump
.htaccess file uses apache server and litespeed / openlitespeed
Here is the code. . .
1
2
3
4
http jump https
RewriteCond% {SERVER_PORT}! ^443$
RewriteRule (.*) Https://%{SERVER_NAME} /$1 [R = 301, L]
1
2
3
4
5
Jump without www to www
RewriteCond% {http_host} ^demo.com [NC]
RewriteRule ^(.*)$ Http://www.demo.com/$1 [L, R = 301]
1
2
3
4
5
With www jump to without www
RewriteCond% {http_host} ^www.demo.net [NC]
RewriteRule ^ (.*)$ Http://demo.net/$1 [L, R = 301]
Implementation of the second nginx platform
Code 1
1
2
3
4
5
6
7
server {
listen 80;
server_name www.example.org example.org;
if ($ http_host = example.org) {
rewrite (.*) http://www.example.org$1;
}
Code 2
1
2
3
4
5
6
server {
listen 80;
server_name example.org;
return 301 http://www.example.org$request_uri;
}
Enter the domain name and find page rules
Add a rule to use a 301 redirect for the Forwarding URL, see the figure below. . .
💘 相关文章
- Tutorial to sync files to backblaze using rclone
- Method to cancel ssh key password
- Solution to garbled laptop keyboard
- how to find out the ssh port of the cpanel host
- Openlitespeed /litespeed deny methods to access folders and files
- acme.sh The domain is not a cert name解决方法
- 100 Things to Do Between Couples
- Artifact, use EmEditor to quickly clear excess white space in your code
- How to query the hard disk usage time of various distribution Linux systems
- How to apply for a free ipv6 address