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.

Answers


use

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

Memory Stress Testing in C#

c# memory-management stress-testing

I want to create a tool to simulate memory restrictions to memory stress test other applications. I came up with the following code after going through some google searches, but when running this, ...

Keep current page when sorting in @grid.GetHtml

c# asp.net-mvc-4 pagination webgrid

Is there any way to keep current page when sorting @grid.GetHtml columns?