简体   繁体   中英

htaccess file works on server, doesn't work locally

I've been searching around and trying all sorts of different approaches, but I can't seem to figure out what's wrong.

I have the following piece of .htaccess code:

Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
#  Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

It works fine on the production server, so that insinuates that the config file is set up okay there. I'm trying to develop for this site locally though, and there I get 404 errors saying that the file does not exist when I go to localhost/example/login (which corresponds with domain.com/login).

I have tried different settings, setting AllowOverride All, checking if mod_rewrite is enabled in phpinfo(); and what not. But I can't seem to figure out what's wrong.

Any suggestions?

check out if mod_rewrite is enabled. Don`t forget to restart apache. Check your virtualhosts, is allow override is on?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM