views:

29

answers:

3

Hello,

I'm working on my project and now I want to transfer it from my localhost to server. Everything seems to work fine, but .htaccess doesn't work.

The server should be suporting mod_rewrite and print_r(apache_get_modules()); shows mod_rewrite running.

But still, when I type myaddress.com/contact, it shows error 404.

Here is the .htaccess file, but it should be fine, since it runs on my localhost:

RewriteEngine on
RewriteRule ^adminator/?$ adminator/login.php [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?page=$1&detail=$2 [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]

Do you have any idea?

Thanks, Mike.

A: 

Does the server allow .htaccess? It doesn't really have to.

Try other directives, ask your hosting provider, or check the configuration yourself if possible.

Mewp
Well, it's saturday, so I'll have to wait to monday, but where can I check the configurations?
Mike
Search in /etc. For example `/etc/httpd/conf/httpd.conf`. If you do not have ssh access, use `glob()` and `file_get_contents()`.
Mewp
A: 

I tried testing your rules they should be fine on urls such as: http://myhost.com/test1 and http://myhost.com/test1/test2 result in requesting url: index.php?page=test1 and index.php?page=test1&detail=test2

So the problem is not your rules, it is your server setup somewhere. As Mewp said check your Apache config file, look for AllowOverride which should be enabled for .htaccess files to overriding default settings.

Cheesebaron
A: 

Ok, fixed it .. deep in the hostings settings, there was an option to activate it .. but I found it after 4 hours of looking around .. :P

Mike