1

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.

2 Answers 2

1

Just, try this code :

RewriteEngine on
RewriteRule ^photography$ /photography.php
Sign up to request clarification or add additional context in comments.

3 Comments

Looking at the server logs, I still get the following: Negotiation: discovered file(s) matching request: /var/www/photography (None could be negotiated).
And if you try to access to your site with photography, do you have a 404 error ?
Thanks for the reply. It was a config issue. Will post an answer now.
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.