php - How to rewrite URL using htaccess for clean url (remove unnecessary parameter from url) -
i working on localhost php project. need solution.
current url : http://localhost/project/portfolio/php_files/port_sub_sidebar.php?x=opencart
now, want show in url this: http://localhost/project/portfolio/opencart
how's possible doing change in .htaccess file
in .htaccess
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !^/(.*)(\.jpg|\.gif|\.png|\.css|\.js)$ rewriterule ^(.+)$ index.php?url=$1 [l,qsa]
you can url code below
$url = $_get['url']; $segments = explode("/",$url); print_r($segments);
then can implement routing system based on provided segments
Comments
Post a Comment