开发者

How does URL rewriting work?

I am new to URL rewriting and I have an .htaccess file that looks like this:

RewriteEngine On
RewriteRule     /*\.(css|js|gif|png|jpe?g)$ - [NC,L]
RewriteRule "^(.*)$"    "www/index.php?_url=$1" [QSA,L]

Does this code just rewrite the code internally, or is it supposed to c开发者_开发技巧hange to URL in the address bar? As of now it does not change the address bar, and I'm not really sure yet but I am thinking that I will probably want the option to do so for bookmarking purposes. So if there is a way could you please let me know or direct me to a pretty noob friendly guide on URL rewriting where I can figure it out on my own because I haven't been able to find one.

Thanks for the help!


As it stands, it will just do an internal rewrite. To redirect the user (thereby changing their address bar), add R to the flags (e.g. [NC,R,L] or [R,QSA,L])


URL rewriting is completely server-side (unless you do a redirect). The client (and thus their address bar) will not know what the server is doing with the URL.

Here's a good beginner tutorial that explains URL rewriting and goes through progressively more complex examples.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜