views:

35

answers:

2

I have the following rewrite rule, but nothing is hapenning at all when I try to use it. I have the file in the directory server.blahblahblah.com/todo and the following is my .htaccess file:

Options +FollowSymLinks
Options +Indexes

RewriteEngine On
RewriteBase /

RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1
RewriteRule ^tasks/view/([0-9]+)\.xml$ controller.php?task=viewxml&id=$1
RewriteRule ^tasks/new?/$ controller.php?task=new
RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1
RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1
RewriteRule ^tasks?/$ controller.php?task=home

Does anyone know why this won't work at all?

Thanks,

Tim

A: 

If nothing happens at all, it might be that you didn't enable .htaccess files for your site. To do that, change your site configuration (/etc/apache2/sites-enabled/<yoursite>) to include AllowOverride All instead of AllowOverride None (the default). But mind the performance disadvantage - you could also put the rules directly in the site configuration.

In case that doesn't solve it, look at the Apache logs in /var/log/apache2/*.

AndiDog
A: 

Thanks, you are right that I didn't have .htaccess enabled. It's working now however, and I know it is because I had an Internal Server Error which I then fixed.

However, none of the rules are working still. Do you know how I might fix this?

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /

RewriteRule ^shortcut$ /docs

RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1
RewriteRule ^tasks/view/([0-9]+)\.xml$ controller.php?task=viewxml&id=$1
RewriteRule ^tasks/new?/$ controller.php?task=new
RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1
RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1
RewriteRule ^tasks?/$ controller.php?task=home
Tim Rogers