Jump to content

Rewrite Title From Database


Boxerman

Recommended Posts

You would create a rewire rule that passes the title of the movie to a script, then you use that title to lookup the movie. Eg:

 

RewriteRule /watch/(.*)$ movie.php?title=$1

 

Then in movie.php you would use $_GET['title'] to query the database for the movie and display it.

 

You'll need to make sure all your titles are unique for each movie in order to find the proper one.

 

An alternative would be to do like the forums here do and stick the ID and the title in the URL. Eg:

/watch/1234-my-movie

 

Then you would not need to have a unique title because you can look them up by the ID, but you still get a nicer looking URL. A rule like this should handle that type of setup:

RewriteRule /watch/(\d+)-.*$ movie.php?id=$1

 

 

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.