开发者

PHP, LAMP server, changing display paths of certain URLs?

I apologize if this is a basic question, however I have been searching on this and can't find anything of use, probably since I don't really know the proper terms.. I am wondering if there is a way to interpret the url that is called on the server, such as:

http://mydomainname.com/site1/module1

and then using PHP (ideally), or some other technology if necessary, change the display of the url to the use as something else, such as:

http://domainname.com/app1

I realize I would have to put in specific things to change urls to and from, just am not sure if this is possi开发者_JAVA百科ble.. thanks for any advice.


You are looking for information on URL rewriting. Since you are using Apache, the mod_rewrite module is probably what you are most interested in. Unfortunately, I'm not that familiar on the topic and frequently have to consult guide myself. But at least you have some reading material until someone with more knowledge in this area can help you.


An .htaccess file like this works:

Options +FollowSymLinks
RewriteBase /
RewriteEngine On
RewriteRule \.(css|js|png|gif|jpg|xml|txt|zip|rar|swf|flv|as|ico|csv|xls|php|pdf|html)$ - [S=1]
RewriteRule .* index.php [L,NC]

Your index.php file will need to handle the routing of the page from there. It's a good place to start for those with custom content management systems.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜