To make .htaccess files work as expected, you need to edit this file:
/etc/apache2/sites-available/default
To enable rewite mode on the configuration file, please do the followings.
- Open /etc/apache2/sites-available/default in your favourite file exitor.
- Look for the Directory section of the configuration file. Example:
- Change AllowOverride None to AllowOverride All
- Save this file and then reload Apache as follows: #service apache2 reload
To enable apache2 rewrite module, use the Linux command listed below:
#sudo a2enmod rewrite
To activate the new configuration, you need to run the command listed below:
#service apache2 restart
To verify whether the module is working fine or not, please use the command listed below and check whether the rewite module is on the list.
#apache2ctl -M
Example configuration for .htaccess file.
# Original
# If you modify this file then change the above line to: # Modified
RewriteEngine On
# Certain hosts may require the following line.
# If vanilla is in a subfolder then you need to specify it after the /.
# (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
To password-Protect a directory with .htaccess, please refer https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles
0 comments:
Post a Comment