How to create friendly URL in php?

后端 未结 8 1861
一整个雨季
一整个雨季 2020-11-21 11:06

Normally, the practice or very old way of displaying some profile page is like this:

www.domain.com/profile.php?u=12345

where u=12345

8条回答
  •  太阳男子
    2020-11-21 12:03

    Simple way to do this. Try this code. Put code in your htaccess file:

    Options +FollowSymLinks
    
    RewriteEngine on
    
    RewriteRule profile/(.*)/ profile.php?u=$1
    
    RewriteRule profile/(.*) profile.php?u=$1   
    

    It will create this type pretty URL:

    http://www.domain.com/profile/12345/

    For more htaccess Pretty URL:http://www.webconfs.com/url-rewriting-tool.php

提交回复
热议问题