I'm new to server administration but I was able to get a LAMP setup running on my new VPS. I uploaded a few web files that work on my other server, but they seem to give me the error: "File does not exist" in my /var/log/apache2/error.log file. The homepage loads just fine through my scripting, but other pages don't.
.htaccess file code
Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?r=$1 [L,QSA]
I have enabled mod_rewrite on the server and can see it running under my phpinfo() page I have created. Simply don't know why this issue is happening. If I need to post anything else, please let me know :)
The mod_rewrite module is a rule-based Apache engine for rewriting URLs. The rules allow writing various queries to change URLs into the desired format. Some applications include page redirecting or proxy fetching. This article shows how to set up, configure, and rewrite URLs using mod_rewrite.
Save the file and type the URL yoursite.com/foobar/ . If the reditect works and the URL gets redireted to the homepage of example.com then it's clear that your htaccess is working and being read by your Apache server. If it still doesn't work then the problem might be that your hosting provider has not enabled it.
It looks like your site or virtual host has not been granted the appropriate permissions to process .htaccess
files. You can test it easily by making a syntax error on purpose: if your site does not crash, the file is being ignored.
Try something like this in your main httpd.conf
file:
<Directory "/path/to/your/site"> AllowOverride All </Directory>
... or this (to your liking):
<VirtualHost *:80> AllowOverride All </VirtualHost>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With