Reputation: 751
I've set up a LAMP stack on my Raspberry Pi as a development environment for my website.
I am trying to implement URL rewriting to make my URLs prettier, but it doesn't seem to be working.
I have tried the following:
sudo nano /etc/apache2/sites-enabled/000-default
and under the var/www
section changed the line AllowOverride None
to AllowOverride All
I was getting a Internal Server 500 error, so I ran a command to allow the server to use the .htaccess
file (can't remember the command now).
I also restarted the server and Raspberry Pi.
I no longer get the error, but when I look in the error log by using the command
tail -f /var/log/apache2/error.log
I get a 404 Not Found error.
Here's my .htaccess file (it's really simple for now).
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^photography$ photography.php
Not sure what I'm doing wrong, and whether it is a server configuration issue or a programming error. Any help much appreciated.
Upvotes: 1
Views: 2419
Reputation: 751
Found the answer here: mod_rewrite not behaving nicely
Edited the line in the /etc/apache2/sites-enabled/000-default
file to be:
Options -MultiViews +FollowSymLinks
Upvotes: 1
Reputation: 7063
Just, try this code :
RewriteEngine on
RewriteRule ^photography$ /photography.php
Upvotes: 1