.htaccess rewrite friendly URLs

前端 未结 2 1821
南旧
南旧 2020-12-11 05:27

I am not sure if this is possible, but I have the following URL that I want to make more friendly:

http://www.myurl.com/content.php?id=13089093057550&slu         


        
2条回答
  •  一生所求
    2020-12-11 06:00

    You can get the slug into the querystring, but without providing the id somewhere it's impossible for Apache to supply it. Hopefully you have a way to get the id out of your database using only the URL slug parameter.

    RewriteEngine On
    # We don't know the id
    RewriteRule (.*)$ /content.php?slug=$1 [L,QSA]
    

提交回复
热议问题