If you want to use an
.htaccess
file to manage URL rewriting on your Turnkey Linux LAMP stack server, there are a few steps you will need to perform to make this work.First you must enable mod_rewrite for Apache.
Log in it to Webmin and press Command Shell from the Tools menu.
Enter the following command then press Execute command.
a2enmod rewrite
Next you need to allow overrides so that Apache will allow URL rewrite rules in a .htaccess file.
In the Servers menu, press Apache Webserver and then find your website in the list of existing virtual hosts and press the edit button (globe icon).
Then from the Virtual Server Options page press Edit Directives.
Add the following line inside of the Directory section:
AllowOverride All
Finally you can create a
.htaccess
file in your website folder with the rewrite rules you need. Following is an example that will load the index.php page for any request for a file or folder that does not exist.Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
Make sure you include the first line,
Options FollowSymLinks
.
Rate this post:
Comments
There are no comments yet. Be the first to leave a comment!