0

how to change the php url like this one http://amazkart.in/product.php?id=1

into the url that contains keywords of its title like this

http://gadgetsreviews.in/product/apple-iphone-5s/

and how to do that for my each url and old urls will be redirected to this new urls,no 404 error should be occured

  • see the basic of htaccess rewrite rule – Awlad Liton Apr 03 '14 at 07:11
  • 1
    I think you should [read up](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php) on [SQL Injection](http://amazkart.in/product.php?id=%27) before attempting to rewrite. – Dave Chen Apr 03 '14 at 07:20

1 Answers1

0

You shall use .htaccess for url rewriting

But the url rewriting should following some sort of logic like the following code:

<?php
output_add_rewrite_var('var', 'value');

// some links
echo '<a href="file.php">link</a>
<a href="http://example.com">link2</a>';

// a form
echo '<form action="script.php" method="post">
<input type="text" name="var2" />
</form>';

print_r(ob_list_handlers());
?>

Source : http://www.php.net/manual/en/function.output-add-rewrite-var.php

Here is the tutorial for url rewriting.

http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Sulthan Allaudeen
  • 11,330
  • 12
  • 48
  • 63