How to enable URL rewriting using the Turnkey Linux LAMP stack
by johna | December 27, 2023 | Website Hosting
This post is a follow-up to my original post on How to set up a website and database using the Turnkey Linux LAMP stack.
If you want to use an
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.
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:
Finally you can create a
Make sure you include the first line,
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
.
Related Posts
How to set up a website and database using the Turnkey Linux LAMP stack
by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).
Best value Windows shared hosting - ASPnix review
by johna | April 1, 2023
My experience with ASPnix web hosting over the last ten years.
Telstra BigPond and the message content rejected due to suspected spam error
by johna | December 9, 2020
A rant about Telstra's anti-small business mail server blacklisting policies.
Comments
There are no comments yet. Be the first to leave a comment!