0

i am not sure how to debug my issue and have researched a few questions similar with no luck.

Here is my origanal URL http://localhost/title.php?title=test

What i was hoping to achieve http://localhost/title/test

I have edited my .htaccsess file to the following:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule   ^.+/title/([0-9]+)   title.php?title=$1    [QSA,L]

In title.php i use $_GET['title'] to retrive the data from my table and from my understanding from the question i linked above this should work.

Currently the page loads but no varrible is getting passed through.

Nashie
  • 311
  • 1
  • 10
  • 3
    I would recommend to use the [front controller pattern](https://en.wikipedia.org/wiki/Front_controller) together with a [router](https://packagist.org/?query=router) instead. Then you can set up all URL's directly in your application instead of editing the web server to handle specific application routes. It also makes the code more portable between other web servers (like nginx, which doesn't use htaccess). It's how "all the cool kids" are doing it (all major frameworks) – M. Eriksson Jun 06 '21 at 21:17
  • 1
    You don't have `/title/\d` in your path. Title is a name, not number. – user3783243 Jun 06 '21 at 21:18

0 Answers0