How to change URL in core PHP? Please let me know how to do this
http://localhost/files/rajfireworks/product_details?pro_id=2
to
http://localhost/files/rajfireworks/product_details/productname
How to change URL in core PHP? Please let me know how to do this
http://localhost/files/rajfireworks/product_details?pro_id=2
to
http://localhost/files/rajfireworks/product_details/productname
This can help you:
Write below code in your .htaccess file.
For inner page write: RewriteRule ^products/([^/]+) product_details.php?name=$1 [NC]
For all product page: RewriteRule ^products products.php [NC]
This can help:
<?php
if(!empty($_GET['pro_id'])) {
header("Location: /files/rajfireworks/product_details/productname");
}
?>
Depends on product_id
number - you can extend your conditions.
You can Use URL rewrite in htaccess File.
Put .htaccess file in main folder and use below code.It will read like if your URL http://example.com/index.php?page=search it will show like this http://example.com/search
Code:
RewriteEngine on
RewriteCond %{THE_REQUEST} /product\.php\?cat=(search)
RewriteRule ^ /%1? [R=302,L]
RewriteRule ^(search)$ /product.php?page=$1 [L,QSA]
Add the following to your .htaccess:--
RewriteEngine On
RewriteRule ^blog/([^/]*)\.html$ /test/test.php?pagetitle=$1 [L]