开发者

PHP Dynamic Folders

开发者 https://www.devze.com 2023-01-04 02:17 出处:网络
Using PHP, how can you make a dynamic fo开发者_JS百科lder system, like http://website.com/user/UsernameHere/ show something like http://website.com/user.php?name=UsernameHere

Using PHP, how can you make a dynamic fo开发者_JS百科lder system, like http://website.com/user/UsernameHere/ show something like http://website.com/user.php?name=UsernameHere

Does this require server configuration, or is it possible with PHP?


Typically this will rely on some amount of URL-rewriting support from the web server, for instance, some mod_rewrite rule under apache.

Whether or not it's a bunch of complicated rewrite rules, or just a simple one that rewrites everything to /index.php (and let's index.php parse and interpret the URI), doesn't matter.

But you'll need some amount of web server configuration to get it going.


There's a few techniques for doing this. It's nearly possible to clean up your URLs using just PHP, but ultimately if you want to get rid of the ".php" extension you'll need to do something with your server. If it's Apache you can clean up using the .htaccess file.

0

精彩评论

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

关注公众号