Mod rewrite problem with Ubuntu |
[eluser]Mohammed Zayan[/eluser]
I use Ubuntu and enable mod_rewrite in Ubuntu by: Code: sudo a2enmod rewrite Code: sudo /etc/init.d/apache2 restart and I use this code in .htaccess file Code: <IfModule mod_rewrite.c> when I use: http://localhost/zayanit/site/index I have this error: The requested URL /zayanit/site/index was not found on this server. Apache/2.2.17 (Ubuntu) Server at localhost Port 80 but if I put index.php in url it works. So what is the problem?!!
[eluser]WanWizard[/eluser]
Your rewrite rule is looking for /index.php, is it in the root of the docroot?
[eluser]Mohammed Zayan[/eluser]
Yes And when I write http://localhost/zayanit/index.php/site/index in the url the page working without any problems
[eluser]WanWizard[/eluser]
Are you using a fastCGI installation? If not, the question mark should not be part of the rewrite rule. so Code: RewriteRule ^(.*)$ /index.php/$1 [L]
[eluser]Mohammed Zayan[/eluser]
I don't know what is fastCGI installation so, I think I don't use it. And I remove the question mark from the rewrite rule. My code now is Code: <IfModule mod_rewrite.c> It still doesn't work
[eluser]CroNiX[/eluser]
Try this by itself. If it doesn't work, try removing the ?. I use this on Ubuntu 10.04 (except I don't need a RewriteBase). The rest of that is unneeded for CI 2+ Code: RewriteEngine On Also, I think the problem might be with your if blocks. On my server, the extensions are .so, not .c. If you use the above this will probably confirm that.
[eluser]Mohammed Zayan[/eluser]
I try Code: RewriteEngine On And Code: RewriteEngine On It doesn't work. I use Ubuntu 11.04 |
Welcome Guest, Not a member yet? Register Sign In |