0

I have a lot of titles and details in the database, and I don't want to create a file for each record, but I want to create a dynamic page with different URL that will display the details with a link to that dynamic page.

For example, when user click on a link like: href="./sports/football"

the dynamic page shows the details in following URL: ./sports/football.php

NOTE: I don't want the URL address to be like the following: ./sports?search=football;

Dharman
  • 30,962
  • 25
  • 85
  • 135
Mohsen
  • 1
  • 2
  • 3
    Go read up on _URL rewriting_ … (This gets asked about all the time, and there are plenty of explanations how it works available on the net.) – misorude Jul 31 '19 at 12:50

1 Answers1

0

Ok you do this:

  1. https://www.generateit.net/mod-rewrite/index.php
  2. Copy your desired URL and paste inside 1.)
  3. put sports/ at Prefix tab
  4. select empty box in Suffix tab
  5. And you'll get
RewriteEngine On
RewriteRule ^sports/([^/]*)$ /sports.php?search=$1 [L]
  1. create file named .htaccess and paste 5.) inside and save
  2. Try open your link again and it will be like http://www.myurl.com/sports/football
Wilf
  • 2,297
  • 5
  • 38
  • 82