maximebf / atomik

Micro framework for PHP 5.3+ [UNMAINTAINED]
MIT License
46 stars 18 forks source link

url rewriting #25

Closed olaulau closed 10 years ago

olaulau commented 10 years ago

Hi ;

I'm trying to make URL rewriting work but can't figure out why I fail. Of course I've enabled mod_rewrite in apache and put .htaccess at the root of my project. Atomik doesn't detect my rewrite as functionning (generates URL with index.php?action=add). If I try to use a rewrited URL such as /atomik/add/ if returns a 404 : The requested URL /var/www/index.php was not found on this server.

can you provide a few tips or a small tutorial to have an Apache config that works with atomik (for exemple on debian / ubuntu) ?

best regards.

maximebf commented 10 years ago

try with Atomik::set('atomik.url_rewriting', true);

olaulau commented 10 years ago

This forces Atomik to generate URL such as /atomik/add/, but this URL still doesn't work. I think it's an apache configuration issue, can you provide a simple install procedure for debian ?

maximebf commented 10 years ago

some apache configuration do not allow .htaccess files. Try adding AllowOverride All to your <Directory> configuration

olaulau commented 10 years ago

AllowOverride All helps in some cases. but URL in the error is different if I don't have .htaccess file, so rewrite rules are effectives. seems that it works in simple cases, like placing atomik project in apache www directory. usage of Alias or UserDir doesn't work. any idea ?

maximebf commented 10 years ago

If you are using Alias, you have to be careful that the target directory also has a directive. Example:

Alias /atomik /home/atomik
<Directory /home/atomik>
AllowOverride All
</Directory>