views:

57

answers:

1

I'm still pretty lost with mod_rewrite as its incredibly new to me. I'm trying to set up a few rules for better urls. However, after playing around with it for awhile it appears that it only ever uses the first rule listed. For example, if i go to "/frontpage/some-post-slug" it works perfectly but if i go to "/page/some-page-slug" I get a 500 Internal Server Error. Does anyone have any idea what would be causing this?

my .htaccess file is in full below:

<IfModule mod_rewrite.c>

    Options +FollowSymLinks

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^frontpage/([A-Za-z0-9-]+)*$ /frontpage/?slug=$1 [NE,L]
    RewriteRule ^page/([A-Za-z0-9-]+)*$ /page/?slug=$1 [NE,L]

</IfModule>

Thanks for any help!

+1  A: 

What happens if you remove the * before the $-sign? I never use them and my rules are pretty much the same as yours.

Ben Fransen
hah. I guess I only know enough about regular expressions to get me by. That took care of it. amazing. By the way, I would really like to set it up so that the second rule is something like RewriteRule ^/([A-Za-z0-9-]+)*$ /page/?slug=$1 [NE,L] so that to get to say a contact page the url wouldnt be /page/contact it would just be /contact. I tried to do this at first, them just assumed mod_rewrite was finicky on the "/" directory. Do you know how I could accomplish this?
seventeen
well... without the asterisk^^
seventeen
nevermind, I got it. Thanks for all your help!
seventeen