Convert Dynamic url to seo friendly url in php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Convert Dynamic url to seo friendly url in php

I have a php file which generate url like http://example.com/file.php?c=text1&s=text2&z=text3. I want to get url in below format http://example.com/id/text1/text2/text3 I am trying mod rewrite but i am not able to do it. Please provide me a suitable code to do this

29th Jun 2019, 9:57 PM
Aditya
Aditya - avatar
7 Answers
+ 7
Freezemage Not necessarily... URL rewriting can be implemented at the server level rather than the application level, which is what you are referring to with MVC routing.
30th Jun 2019, 1:40 AM
David Carroll
David Carroll - avatar
+ 5
What happens when you apply the rewrite rules in your .htaccess file? If your .htaccess file in the correct directory? Paste the rewrite rules you applied. Also, are you certain the mod rewrite module is enabled in your web server? I'm assuming you are using Apache Web Server. If that correct?
29th Jun 2019, 10:51 PM
David Carroll
David Carroll - avatar
+ 4
Wow, dude, that's a lot you need to do. You need a routing system that will determine based on current URL what the user wants from current view instance, transfer the parsed result to controller and THEN do the work. Try reading about URL Routing and MVC paradigm.
30th Jun 2019, 12:58 AM
Freezemage
Freezemage - avatar
+ 4
Aditya The notes in your code are great. I'll take a look and will respond in the comments thread of your code.
30th Jun 2019, 4:03 PM
David Carroll
David Carroll - avatar
+ 3
I added the code i am using. Can you pls tell what i am doing wrong. Can you please provide a simple code to do that. I don't want a complex routing system maybe simple one can do that . https://code.sololearn.com/wkxS393lcdM0/?ref=app
30th Jun 2019, 3:37 PM
Aditya
Aditya - avatar
+ 3
I tried to be clear, but in any case you get confusion on what i need from that code. Pls message me i will reply
30th Jun 2019, 4:18 PM
Aditya
Aditya - avatar
+ 2
Link your non working code here.
29th Jun 2019, 10:48 PM
John Wells
John Wells - avatar