Rewriting urls with mod_rewrite - GET variables

I found out I could make clean urls with mod_rewrite. I managed to make pages like /home.php viewable by visiting /home (without .php).

Now, I'd like to turn view_album.php?album_id=23 into album/23

This is the code I use, but sadly it's not working:

Options SymLinksIfOwnerMatch MultiViews
RewriteEngine On
RewriteBase /beta/
RewriteRule ^album/(.*)/ view_album.php?album_id=$1

Thanks in advance.



RewriteEngine On
RewriteBase /beta/
RewriteRule ^album/([0-9]*)$ view_album.php?album_id=$1

and make sure you only rewrite if a noting or a number follows album/, so your can access your images, which may be in a folder named album.

Need Your Help

Transferring data from one SQL table layout to a 'new & improved' one

sql sql-server data-migration

The project I work on has undergone a transformation at the database level. For the better, about 40% of the SQL layout has been changed. Some columns were eliminated, others moved. I am now tasked...

scala case class with casbah. Accept objectid parameter as string or as a objectid

scala implicit-conversion case-class casbah

I am kind of new to scala and have not done any programming in java or object oriented programming languages.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.