Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
In the httpd.conf file of apache (I’m using WAMP 5)
I uncomment
LoadModule rewrite_module modules/mod_rewrite.so
and I change None to All
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
… I restart all services and nothing happened When I try to access to a page I get the error
Not Found
The requested URL /myProject/site/aboutUs was not found on this server.
myProject is the name of my project folder inside the www folder of WAMP
When I comment (showScriptName=>false), in the main.php, the page shows correctly but with this type of path
localhost/myProject/index.php/site/aboutUs
I can’t hide index.php
I read the all post about this problem but I can’t solve the problem …How Can I fix this issue??
If it’s Apache the rewriting to index.php does not work. I remember having issues with subfolders sometimes. You could add this to your rewrite configuration, maybe it helps:
RewriteBase /myProject
You can also enable RewriteLog and set RewriteLogLevel (only possible in httpd.conf, though), to get loads of debugging from your rewrite module. This should help to find out, what’s going on. More details here:
How I know if the error is from Apache or Yii?? I supose actually is from Yii
I added RewriteBase /myProject
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myProject
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
but the error is the same
I add this lines to the httpd.conf to enable the rewritelog
...
RewriteLog "c:/wamp/www/rewrites.log"
RewriteLogLevel 5
RewriteEngine on
...
and when I try to access the page ‘aboutUs’, I get this log
127.0.0.1 - - [27/Jan/2011:07:38:06 --0500] [localhost/sid#2bfe38][rid#107cbc0/initial] (2) init rewrite engine with requested uri /myProject/site/aboutUs
127.0.0.1 - - [27/Jan/2011:07:38:06 --0500] [localhost/sid#2bfe38][rid#107cbc0/initial] (1) pass through /myProject/site/aboutUs
I guess the rewrite rule of the .htaccess file doesn’t work
If your rules doesn’t work, it’s Apache that throws the error. Yii’s errors look completely different and they tell you, that it was Yii who created the error message. You can also check Apache’s error.log to see, which page it tried to access and couldn’t find.
Some here reported problems with the default rewrite rule. Can you try to replace the last line with this?
Hmm. Can’t really tell what’s wrong. You need to experiment with mod rewrite. Try different simple URLs in your browser and examine the mod rewrite log. The rule says pretty clear that anyhting not being a file or directory should be rewritten to index.php. Examine what happens if your remove the two RewriteCond lines (just for testing!). Also try to remove the enclosing <IfModule…> directives.
It’s very likely that it’s only a small issue somewhere. You will find it!
Had problem with this as well. What finally worked for me is adding this in apache2/conf/httpd.conf. Obviously this is for a Windows machine.
<Directory "C:\Program Files\BitNami WAMPStack\apache2\htdocs\myapp">
Options Indexes FollowSymLinks +Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Apache conf file can come with default to "AllowOverride None". It needs to be changed to "AllowOverride All" to let apache read properly your .htaccess