user2283026
user2283026

Reputation:

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.

Upvotes: 2

Views: 104

Answers (1)

gamag
gamag

Reputation: 423

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.

Upvotes: 1

Related Questions