Home htaccess syntax and rewrite
Reply: 1

htaccess syntax and rewrite

Bartłomiej Giepard
Bartłomiej Giepard Published in 2017-11-12 13:43:20Z

I would like to create a Friendly URL`s.

I have a movie database, every movie has it id, title, year and slug ('title-year').

On the home page, movies are linked like -> example.com/movie.php?id=28

What rules do I have to write to make the address look like my slug? -> example.com/title-year

I was looking for solutions but I do not understand htaccess syntax.

Benjamin Caure
Benjamin Caure Reply to 2017-11-12 13:58:27Z

Assuming movie.php takes slug as parameter instead of id.


Here is .htaccess code:

RewriteEngine on
RewriteRule   "^/movie/(.+)"  "http://example.com/movie.php?slug=$1"  [R,L]

This should rewrite url



You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.337425 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO