![]() |
Mod rewrite problem with Ubuntu - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Mod rewrite problem with Ubuntu (/showthread.php?tid=52694) |
Mod rewrite problem with Ubuntu - El Forum - 06-21-2012 [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?!! Mod rewrite problem with Ubuntu - El Forum - 06-21-2012 [eluser]WanWizard[/eluser] Your rewrite rule is looking for /index.php, is it in the root of the docroot? Mod rewrite problem with Ubuntu - El Forum - 06-21-2012 [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 Mod rewrite problem with Ubuntu - El Forum - 06-21-2012 [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] Mod rewrite problem with Ubuntu - El Forum - 06-21-2012 [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 Mod rewrite problem with Ubuntu - El Forum - 06-22-2012 [eluser]Mohammed Zayan[/eluser] What should I do to solve it? Mod rewrite problem with Ubuntu - El Forum - 06-22-2012 [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. Mod rewrite problem with Ubuntu - El Forum - 06-22-2012 [eluser]Mohammed Zayan[/eluser] I try Code: RewriteEngine On And Code: RewriteEngine On It doesn't work. I use Ubuntu 11.04 |