开发者

Php application url

开发者 https://www.devze.com 2023-01-01 11:28 出处:网络
I\'ve a doubt. How can I configure my application to use www.mysite.com/myfolder instead of www.开发者_开发问答mysite.com/myfile.php?

I've a doubt. How can I configure my application to use www.mysite.com/myfolder instead of www.开发者_开发问答mysite.com/myfile.php?

I need to a create a profile page for every user registered to my PHP application but it's not so clear how can I do that. I've seen it's possibile with page frame, but, if possible, I prefrer don't use it.

Thanks for the suggestions!

cheers, Andrea


Use Apache's mod_rewrite.


when you go to a website like www.mysite.com/myfolder what apache is actually doing is finding the 'index file' for that folder.This is usually a file called index.html or index.php.

What i suggest using for something like user profiles is Apache's mod_rewrite.


you should check out mod_rewrite. Your real url might be www.mysite.com/somename.php. But mod_rewrite can make the display url be www.mysite.com/somename/

For your user profiles, let the url be something like www.mysite.com/user.php?user_id=x and the display url be www.mysite.com/user/x/


You can alter this by changing DocumentRoot in httpd.conf or by using mod_rewrite - its a bit context dependent though really

0

精彩评论

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