php - Convert slash to tilde as Url Separator -


I have a question about how we can separate the URL with a slash instead of a slash, for example I have A URL is:

The first case

  www.domain.com/category/category_id The URL shown will be www.domain.com/category/category_id   

The second case

  www.domain.com/category/subcategory/category_id The URL shown will be www.domain.com/category/subcategory/category_id   

So we will be separating the URL when we have such a position And only the last section will be affected. How Can We Do It In Php I'm Trying To Work In Laravel!

Thanks

  1. Create .htaccess in your www root Put it in and put it in:

    Click to rewrite the revetting engine% {SCRIPT_FILENAME}! -d
    revoked% {SCRIPT_FILENAME}! -f
    revised rule ^ (. *) $ Index.php? Params = $ 1 [QSA]

  2. To get the parameter used in index.php:

    ...
    $ Params = Explosion ('/', $ _GET ['param']);
    $ Last Two = Explosions ('~', $ Parameters [Count ($ Parameter - 1]);
    if (calculation ($ LastTwo) == 2) {$ $ params [count ($ params) - 1] = $ last two [0];
    $ params [] = $ lastTwo [1]; Now you have all parameters in the form of array and you can process it.

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -