Monday, April 22, 2013

Run sudo without asking user password

No password for sudo


Open file /etc/sudoers  and uncomment following line.
%sudo ALL=NOPASSWD: ALL
Save the file.

Now if you run commands with sudo, it does not ask user password.

Friday, April 19, 2013

.htaccess - Error 500 - Internal Server Error

Error 500 - Internal Server Error



To remove this error, check the content of .htaccess. It should be like this. 

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /your-web-project-directory-name/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /your-web-project-directory-name/index.php [L] <IfModule>

If Apache can’t understand any line in your .htaccess, it will cause an error.
When you try to access your web page, it generates the error.

A garbage line in .htaccess can create Internal Server Error.

Example:
Create a file name .htaccess, write your name into it, save it and put it in your web project directory. Now try to access the web page, it will give this error.

Define rewrite rule carefully in your .htaccess. If you write anything in .htaccess which apache can't understand, it will be the reason of Internal Server Error.

If rewrite module is not enabled and you are using rewrite engine in the .htaccess, you may have this error. To find a solution, click here or you can find another solution here.

.htaccess issue - html links are not working

.htaccess - Menu Links are not working


.htaccess links defined in rewrite-rules are not working in apache2

1) Enable rewrite module
   $ sudo a2enmod rewrite    $ service apache2 restart


2) These lines should be in /etc/apache2/apache2.conf
AccessFileName .htaccess <Directory /var/www>     AllowOverride All     #AllowOverride None </Directory> 
Restart apache2.

3) Enter following lines in /etc/apache2/httpd.conf

<Directory /var/www/project-name>     AddHandler cgi-script .cgi     Options +Indexes +ExecCGI     AllowOverride all </Directory> 

4) "AllowOverride all" should be uncommented in apache2.conf or httpd.conf.