84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
There are aliases, redirecting and rewriting functions in apache, but I don’t understand the connection and difference between them
Under what circumstances are they more appropriate to use?
人生最曼妙的风景,竟是内心的淡定与从容!
Contacts and differences... This topic can be big or small... These three are completely different things...
Among them, alias and redirect are both implemented by mod_alias 实现的 ... rewrite 是由 mod_rewrite...
mod_alias
mod_rewrite
alias can achieve functions that the other two cannot achieve at all...
rewrite can realize all the functions provided by redirect and not only that... Of course, as a price, rewrite consumes a lot of money...
Differences in usage scenarios...
alias provides the function of virtual directory... It can map an area that is not accessible through the web to the web...
alias
For example, if your website root is /var/www ... 通过 alias 可以访问到 /home/sunyanzi/public ...
/var/www
/home/sunyanzi/public
redirect provides the webpage jump function... very simple to jump from one URL to another URL...
redirect
Use a practical example... When you visit http://sf.gg, you will jump to /...
When you visit http://sf.gg/bNT4C, you will be redirected to this post... This behavior is a redirect...
rewrite provides the functions of web page jump and change the URL of a page...
rewrite
Web page jump has just been explained... Changing the page URL means... If you have such a function on your website...
http://yoursite.ext/script?model=user&action=detail&username=Sunyanzi
If you think this URL is not good-looking...you can rewrite it as http://yoursite.ext/u/Sunyanzi...
http://yoursite.ext/u/Sunyanzi
and redirect is that when the user visits a new address... the address in the browser address bar will not change...
rewrite also provides proxy function...
That is to say, you can put a page on my website like http://mysite.ext/somepage ...
http://mysite.ext/somepage
rewrite it on your website to http://yoursite.ext/anotherpage ...
http://yoursite.ext/anotherpage
But the prerequisite is that the target of rewrite must also be on a web-accessible area...
Yeah...that's about it...is there anything you don't understand...?
Actually, these things are available online... It’s more comprehensive than this answer I wrote temporarily...
I, I...I just have free time...I will fight back...please comfort...
Contacts and differences... This topic can be big or small... These three are completely different things...
Among them, alias and redirect are both implemented by
mod_alias
实现的 ... rewrite 是由mod_rewrite
...alias can achieve functions that the other two cannot achieve at all...
rewrite can realize all the functions provided by redirect and not only that... Of course, as a price, rewrite consumes a lot of money...
Differences in usage scenarios...
alias
provides the function of virtual directory... It can map an area that is not accessible through the web to the web...For example, if your website root is
/var/www
... 通过 alias 可以访问到/home/sunyanzi/public
...redirect
provides the webpage jump function... very simple to jump from one URL to another URL...Use a practical example... When you visit http://sf.gg, you will jump to /...
When you visit http://sf.gg/bNT4C, you will be redirected to this post... This behavior is a redirect...
rewrite
provides the functions of web page jump and change the URL of a page...Web page jump has just been explained... Changing the page URL means... If you have such a function on your website...
http://yoursite.ext/script?model=user&action=detail&username=Sunyanzi
If you think this URL is not good-looking...you can rewrite it as
The difference betweenhttp://yoursite.ext/u/Sunyanzi
...and redirect is that when the user visits a new address... the address in the browser address bar will not change...
rewrite also provides proxy function...
That is to say, you can put a page on my website like
http://mysite.ext/somepage
...rewrite it on your website to
http://yoursite.ext/anotherpage
...But the prerequisite is that the target of rewrite must also be on a web-accessible area...
Yeah...that's about it...is there anything you don't understand...?
Actually, these things are available online... It’s more comprehensive than this answer I wrote temporarily...
I, I...I just have free time...I will fight back...please comfort...