Home Ask Login Register

Developers Planet

Your answer is one click away!

Sigal Zahavi February 2016

Yii2 + htaccess + wamp gives 404 Not Found

Please help, I've read a lot of posts about this issue, nothing helps.

I have yii2 installation under: c:/sites/mysite

The index.php file is in: c:/sites/mysite/web

I have htaccess file under c:/sites/mysite that looks like this: # turn on rewrite engine RewriteEngine on

RewriteBase / RewriteRule ^index.html?$ home.php [NC,R,L] DirectoryIndex home.php

# on what should it skip the rules
RewriteRule ^(favicon.ico) - [L]

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Do not allow calls from servers testing ou server fi were a proxy
#  http://serverfault.com/questions/499125/banning-all-azenv-php-request-to-my-server
#RewriteCond %{HTTP_REFERER} .*/azenv\.php [NC,OR]
#RewriteRule .* - [F]

#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI}

# otherwise forward it to index.php
RewriteRule . index.php

I have my-vhosts file that has this code: ServerName armanager ServerAlias armanager DocumentRoot "c:/sites/armanager/web" Options Indexes FollowSymLinks Options Indexes FollowSymLinks AllowOverride all Require all granted

Going to mysite on firefox works fine.

I have a controller esController with actionSettings function. I have a view settings.php

Going to mysite/es/settings gives me the dreaded 404 Not Found error.

Can you please help?


Sigal Zahavi February 2016

Ok, I added this .htaccess in the web folder:

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule . index.php

Now, everything works.

Post Status

Asked in February 2016
Viewed 3,337 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life