how to get dynamic URL like mydomain.com/username using zend framework

前端 未结 6 1620
孤街浪徒
孤街浪徒 2020-12-15 15:02

I am developing an application using zend framework. In the application I have to provide a URL for each user like mydomain.com/[username] then public will be able to view

6条回答
  •  爱一瞬间的悲伤
    2020-12-15 15:30

    Try using Apache .htaccess mod_rewrite.

    4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz

    Have you checked zorpia.com.If you type hxxp://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e

    hxxp://yoursite.com/xyz to hxxp://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
    

    source: http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

提交回复
热议问题