URL with only slashes in pure php like codeigniter uri pattern

前端 未结 1 1135
-上瘾入骨i
-上瘾入骨i 2021-01-27 04:03

I have an application which creates stores for users and they can create a single page store using my dashboard.The final URL generated after they create the store is as follows

1条回答
  •  抹茶落季
    2021-01-27 04:45

    You have to use a .htaccess in order to do that.

    So create this file at the root of your project directory (where index.php is).

    .htaccess content :

    RewriteEngine On
    RewriteRule ^store/([a-zA-Z0-9\_]+)/([0-9]+)$ index.php?username=$1&rand=$2
    

    index.php content:

    
    

    Now try using an url like : mywebsite.com/store/jack_97/354 and you should end up with a dump of $_GET telling you that this array contains two keys : "username" and "rand"

    0 讨论(0)
提交回复
热议问题