URL Rewrite without using .htaccess

binay00713

Broken In
Hello everyone,How can i change the url when I am navigating from one page to another.

for example if the existing url is like "www.example.com/product.php?name=xyz&q=service" ,I want to change it to "www.example.com/product/name/xyz/q/service"

But I dont want to use .htacces. How can I do it using php functions only?
 

nbaztec

Master KOD3R
Building on _hsr's reply:

you can use
PHP:
header("location: http://example.com".preg_replace('#(.php\??)|[=&]#','/',$_SERVER['PHP_SELF']));

Please note that this should be before any headers are sent (like the first statement) and may change depending upon your other pages.
 
Top Bottom