New Catalog Urls

I’ve been meaning to do this for some time and that is to use the rewrite engine and have nicer urls for the main site (catalog). Previously, the url would be to something like: http://www.hd-trailers.net/preview.php?id=terminator_salvation

The old url will continue to work and it’ll automatically redirect you to the new url. The new official url will be: http://www.hd-trailers.net/movie/terminator_salvation/

This is all utilizing Apache’s rewrite engine. It took me a while to get a hang of it, but once I remember how to do all the crazy stuff, it wasn’t that bad.

I only needed to add the following lines (assuming RewriteEngine is already on):
RewriteRule ^movie/([^/\.]+)$ /movie/$1/ [R=301,NC]
RewriteRule ^movie/([^/\.]+)/$ /preview.php?id=$1 [NC,L]

I’ve fixed up the code on the main site to point to the new url format. I did hit into issues where references were now broken since I had a previous assumption all my files will be loaded in the base directory, which is no longer true with this url rewrite engine.

If anyone hits into issues (i.e. broken image link) or if something just looks out of the ordinary, please do let us know.