When designing a website what would be good practice for the url designing and related backend.
Say I have a website with news posts on it. I would like the url to look like this:
mysite.com/news/newsItem1
Normally an url like this would reference to a folder called newsItem1 on the server. But in this case there will be a lot of newsItems (stored as xml files), and I don’t think it’s a good idea to create a folder for every item.
The same thing happens when I make the url like this:
mysite.com/news/newsItem1.html
In that case I would have to make a html file for every newsItem.
What I would like is an url that is different for every newsItem, but on the server it basically points to a php file that parses the matching xml file and returns its contents. How would I do that?
For this you have to use .htacces which allows you to redesign the url.
you can use something like this for that you want :
and write the rewrite rule for url design in .htaccess file as:
and the result will be as:
Here is the link for .htaccess tutorial
http://www.htaccess-guide.com/