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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -