-1

enter image description here

I have a URL that looks like this:

http://localhost/DU/edit-product.php?id=1

How would I go about converting that URL to:

http://localhost/DU/edit/1

How to create .htaccess file for this..

Krish
  • 79
  • 6
  • Tell us first what you tried and the issue with it – ikyuchukov Mar 06 '20 at 07:02
  • See this https://stackoverflow.com/a/59695148/12232340 and search on google for **how to create seo urls** –  Mar 06 '20 at 07:16
  • Put this in your htaccess : `RewriteRule ^DU/edit/(.*)$ edit-product.php?id=$1 [L,NC]` and in php `edit post` –  Mar 06 '20 at 07:24
  • not working in my code – Krish Mar 06 '20 at 07:36
  • 1
    I have the impression the OP did not understand what URL rewriting actually is. The OP expects that the references sent out as part of the php generated content are altered, which is not what URL rewriting does... – arkascha Mar 06 '20 at 07:47
  • 2
    @Krish Instead of complaining you should provide constructive information. Comments like "still not changed", "not working in my code", "I got answer for this" do not help at all. You need to provide actual information fro your side. – arkascha Mar 06 '20 at 07:50
  • You probably get downvotes because this question shows no effort from your side to solve your problem. Stack Overflow is *not* a code writing service. – brombeer Mar 06 '20 at 07:50
  • Sorry guys i am not good in english thats the problem – Krish Mar 06 '20 at 07:52

1 Answers1

1
RewriteEngine on
RewriteRule ^edit-([0-9]+)$ edit-product.php?id=$1
Krish
  • 79
  • 6