apache - issues with friendly urls using htaccess and php -
i have problem, may easier if put code. have this:
<?php $view = ""; if(isset($_request["view"]) != "" && $_request["view"]) { $view = $_request["view"]; } else { $view = ""; } #view handler $factory = new \api\factory(); $factory->template('header'); switch($view) { #home case '': $factory->view("home/index"); break; case 'about-us': $factory->view("home/about-us"); break; case 'contact': $factory->view("home/contact"); break; #products case 'products': $factory->view("products/index"); break; case 'details': $factory->view("products/details"); break; #how case 'how-to': $factory->view("how-to/index"); break; #tech documents case 'tech-docs': $factory->view("tech-docs/index"); break; #virtual home case 'virtual-home': $factory->view("virtual-home/index"); break; #shopping cart case 'shopping-cart': $factory->view("cart/shopping-cart"); break; case 'checkout': $factory->view("cart/checkout"); break; #client case 'client-dashboard': $factory->view("client/client-dashboard"); break; case 'client-profile': $factory->view("client/client-profile"); break; case 'logout': clientlogin::dologout(); header("location: index.php"); break; } $factory->template('footer');
don´t ask why, lol. problem this, when user navigates through website see url's this: www.mysite.com?view=products, want can see this: www.mysite.com/products/ want manage using .htaccess how can implement .htaccess rewrite ugly url's nice url's. , asuming view requests handled through index.php
also want see in localhost, http://localhost:8080/index.php?view=products http://localhost:8080/products/
thanks in advance.
you can (replaced $_request["view"]
$_server['path_info']
):
if(isset($_server['path_info']) != "" && $_server['path_info']) { $view = $_server['path_info']; } else { $view = ""; }
Comments
Post a Comment