Ever got the error – Its showing error like “Oops! This link appears t be broken.” when trying to access an apache project like http://localhost/myproject/home
where myproject lies in /var/www/
http://localhost/myproject/index.php/home will work fine
I have write the .htaccess rewrite rules in my project home folder, I got same error this time also.
So here redirection to my project is the problem.
I found we need to Enable mod_rewrite in apache2.2.
For Enable mod_rewrite in apache2.2.
First install the apache2.2,
sudo apt-get install apache2 (this will install apache 2.2)
for the latest system you can enable mod_rewrite using simple command.
a2enmod rewrite
If your system is old system, Please skip the above command.
——————————-Start old system———————————————-
now use locate to find if the mod_rewrite.so is availble on your server
updatedb
locate mod_rewrite.so
you can find this one in “/usr/lib/apache2/modules”
For new apache follow some folder to enable or disable mods.
cd /etc/apache2/mods-enabled
touch rewrite.load
gedit rewrite.load (you may use any editor to edit this file)
now past the following line, if the line is already exist.
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
———————————End of old system—————————————–
Then edit /etc/apache2/sites-available/default or /etc/apache2/sites-available/000-default (check which one available on your system)
Find the following
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
and change none to all like,
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Create .htaccess file in /var/www/application-folder/
Example:
.htaccess file content
RewriteEngine On
RewriteRule ^(application) – [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Finally restart Apache.
/etc/init.d/apache2 restart
or
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
or
service apache2 restart
Loganathan N
August 3, 2012 at 2:42 pm
its worked for me ..nice
thanks 🙂
while starting server 1 error occur:
Syntax error on line 6 of /etc/apache2/mods-enabled/jk.load:
JkRequestLogFormat takes one argument, The mod_jk module request log format string
After Commenting this line #JkRequestLogFormat “%w %V %T” in jk.load it’s worked nice 🙂