Question
Issues with Apache mod_rewrite and .htaccess
Hey, I’m configuring my LAMP droplet (Ubuntu 14.04) to use a simple rewrite rule in the .htaccess file and it’s simply 404-ing every time. My conf file does indeed include the “AllowOverride All” rule (see entire file below) and the .htaccess file in my web directory includes these rules:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteRule ^([A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9])$ /index.php?i=$1 [L]
RewriteRule ^([A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9])/$ /index.php?i=$1 [L]
Conf File contents:
<VirtualHost *:80>
ServerAdmin caleb@scurrylabs.com
ServerName sqworl.com
ServerAlias www.sqworl.com
DocumentRoot /var/www/sqworl.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/sqworl.com/public_html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Any help at all would be much, much appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
some things to check:
have you enabled mod rewrite?
what is the name of your config file? does it match your domain name? are you using the default?
do you have any other rules in your .htaccess that you can check to verify that indeed your htaccess is working?
here is one you can try..this just makes it so when you type in www.yourdomain.com it should immediately go to http://yourdomain.com