Hi, i making listing site. so,for ex. example.com when some1 fill form name and company then i want make url for it
example.com/name/company
please help me in this issue.
Thanks in advance.
mack
5:13 pm on Nov 14, 2014 (gmt 0)
Making the URL is only one part of the problem, you need to make sure your website is able to handle the URL structure and generate pages based on the URL perimeters. Security is also an issue because you do not want your users to be able to add additional values to the URL.
The form part is fairly easy, you simply use a form to pass the variables to the url using the GET method. This will give you something like...
example.com?name=somename&company=somecompany
What you could then do is create a php file to extract the values and do a redirect
1)get the values from the url string 2)validate that all fields are present 3)clean up the fields to remove anything you don’t want in there 4)redirect the browser to the new url
example.com/somename/somecompany
You will then need to use mod-rewrite and create rules to use the new format of url, whilst still handling it internally as the old style of url. For example the page may be somename/somecompany but the rewrite rull will handle this page as ?name=somename&company=somecompany
There are a lot of tutorials online regarding mod rewrite and shortening url's I hope this post gives you some ideas of the concept.