mod_rewrite error?

Discuss practical ways rearrange URLs using mod_rewrite.

mod_rewrite error?

Postby ohyoko2 » Tue Feb 15, 2005 8:26 am

This is what I have in my .htaccess file:

Options -Indexes +FollowSymlinks
RewriteEngine On
RewriteRule ^/users/([0-9A-Za-z_]+)/.+\.html$ /etc/blog.php?user=$1&id=$2 [L]

Why isn't it working? (I know for a fact mod_rewrite works; I tested that already.)
ohyoko2
 

Postby Caterham » Tue Feb 15, 2005 3:12 pm

strip the leading slash for .htaccess
Code: Select all
RewriteRule ^users/([0-9A-Za-z_]+)/.+\.html$ /etc/blog.php?user=$1&id=$2 [L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

second variable not getting parsed

Postby ohyoko2 » Tue Feb 15, 2005 7:27 pm

The Rule worked without the leading slash; however:

The value for the second variable (`id`) is not getting parsed. Why?
ohyoko2
 

Postby Caterham » Wed Feb 16, 2005 7:54 am

The value for the second variable (`id`) is not getting parsed. Why?
Because theer is no second group. May be you ment the part left to .html? There is/was not group defined:
Code: Select all
RewriteRule ^users/([0-9A-Za-z_]+)/(.+)\.html$ /etc/blog.php?user=$1&id=$2 [L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 20 guests

cron