What are the differences between apache's aliases, redirecting, and rewriting?
黄舟
黄舟 2017-05-16 17:04:34
0
1
584

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?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
世界只因有你

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 http://yoursite.ext/u/Sunyanzi...

The difference between

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...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!