Forum Moderators: phranque

Message Too Old, No Replies

Why don't mod_rewrite work?

I have tried to get it work 2 days, please help :(

         

Moofius

2:59 pm on Jan 7, 2005 (gmt 0)



RewriteEngine on
RewriteRule ^test/nyhet/(.*)/ /test/index.php?p=nyheter&id=$1
RewriteRule ^test/nyhet/(.*) /test/index.php?p=nyheter&id=$1

I have this .htaccess file in the root.
The meaning is that when i write:
www.my_webserver_is_not_nice_to_me.com/test/nyhet/12 OR
www.my_webserver_is_not_nice_to_me.com/test/nyhet/12/
I will come to:
www.my_webserver_is_not_nice_to_me.com/test/index.php?p=nyheter&id=12
Please help me. :(

jdMorgan

8:56 pm on Jan 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Moofius,

Welcome to WebmasterWorld!

You may need to enable SymLinks if they're not already enabled. This is required by mod_rewrite.

You can also reduce your code to one rule by using "?" following the trailing "/" to make it optional.


Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test/nyhet/(.*)/? /test/index.php?p=nyheter&id=$1 [L]

If that does not help and you get a server error, then examine your server error log. It will often tell you what's wrong.

Jim