I`ve been implementing and updating websites for some considerable years using the standard URL addresses for accessing content.
I`d heard of the newer methods for enhancing the addresses in particular helping with SEO. SO it was time to look into how this is done. The image shown shows `award-winning-products` as the permalink address from [the Q Guild of Butchers ] website.
Traditionaly the web addresses I was using names and data on the URL, what that mean`s is that the name of the parameters are being used for passing information to the webpage.
An example with that format is:
https://dafc.co.uk/index.php?SID=First+Team&D=2018-08-18&ID=1172
or
https://dafc.co.uk/index.php?c=News&sc=The+Boardroom
The first one passes three values SID, D and ID while the second one passes a category (c) and subcategory (sc).
Nowadays these should be simplified and shown as :
https://dafc.co.uk/fixture/first-team/2018-08-18/1172
and
https://dafc.co.uk/news/the-boardroom
The issue now then is to how to change the website design and the server to be able to use this new format.
Web site address
But firstly lets have a review of the current method before going onto how the new method will work. The traditional method of setting up a website and links passes parameters into the new web page on the URL. Normally the field name is used as the reference along with the actual value. For example `index.php?ID=2718` means the value of 2718 ias passed is as the ID field (thi svalue is then used to look up a database and the data from that entry is then shown on the page.
This means that the script file index.php needs to get the input value for the variable ID which in this case is 2718. This means that the script file is known to the viewers of the wbesite (perhaps a security issue as hackers could use that as a means of trying to break in ? - but then there are other features you need to recognise to block hackers). Overall the URL itself is not very readable or memorable.
With the newer permalink url address it is much simpler and easier to understand as well as hiding the underlying implementation mechanisms. Also it is more search engine friendly.
URL redirection
normally the web address contains the name of the script file that will be used to load the page. For example one of the pages above `index.php` will be used to load the page.
The term
permalink means the full fixed address for the web page, more can be found on the link. The PHP scripts now need to be modifed to be able to handle this permalink.
The normal default pages used when loading a web page are index.html, index.php or some other filename specified in the apache configuration. My default filename is always `index.php`.
Therefore to be able to handle the new permalink we need our `index.php` file to be able to handle these input parameters. The way I`ve chosen this is to use the default file `index.php` to handle the input parameters. I will also have separate handlers to handle the home page, the news list page and the unique story page (there are many more options so will just keep it simple.