开发者

Neater Url Structure

开发者 https://www.devze.com 2023-03-29 05:50 出处:网络
I am using PHP and Apache Server, and I would like to know how I could change my navigation structure from www.website.开发者_运维问答com/?about to www.website.com/#about?You can\'t.# denotes the frag

I am using PHP and Apache Server, and I would like to know how I could change my navigation structure from www.website.开发者_运维问答com/?about to www.website.com/#about?


You can't. # denotes the fragment identifier, and it's resolved on the client-side (the browser simply scrolls to the anchor called about). It's not sent to the server.

However, if you want to use e.g. www.website.com/about, then you can do that. You need to use *mod_rewrite*, see the Apache URL rewriting guide.


This website has some great examples. http://www.bloghash.com/2006/12/apache-mod_rewrite-examples/

Exactly what I was looking for.

RewriteEngine on RewriteRule ^([^/.]+)/?$ /index.php?url=$1 [L]

0

精彩评论

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