Alpha-numeric rewrite

New to mod_rewrite? This is a good place to start.

Alpha-numeric rewrite

Postby laltoofan » Tue Jul 20, 2004 5:07 am

I can get the following rewrite to work:

Code: Select all
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/blog/([0-9]+)
RewriteRule ^(.*) /blog.php?id=%1 [L]


...but I want to get it working with the following URL - /view/2004-07-20, which will redirect to /view.php?xml=2004-07-20.xml

I've tried variations on these lines:

Code: Select all
RewriteCond %{REQUEST_URI} ^/(([0-9]{4})-([0-9]{2})-([0-9]{2}))$
RewriteRule ^(.*)$ view.php?xml=$1
-----
RewriteRule ^view/.*([0-9]{4})-([0-9]{2})-([0-9]{2}) /view.php?xml=$1
-----
RewriteRule /view/([0-9]{4})-([0-9]{2})-([0-9]{2}) /view.php?xml=$3 [L]


I can't get any of them to work, only return a 404 error. Can anyone help?
laltoofan
 
Posts: 4
Joined: Tue Jul 20, 2004 5:01 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 36 guests

cron