Hi,
I’ve setup a droplet with Ubuntu LAMP on 14.04, enabled mod_rewrite using sudo a2enmod rewrite and confirmed this with phpinfo().
I’ve also setup a vhost with using the following config:
<VirtualHost *:80>
ServerAdmin foo@foo.co.uk
ServerName foo.com
ServerAlias dev.foo.com
DocumentRoot /var/www/dev_foo/public_html/application/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
My 000-default.conf file is this:
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But I can’t get it to work, any tips?
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Thanks for the speedy response, sadly I’ve tried that and it doesn’t work :(
In order for directives in an .htaccess file to be used you need AllowOverride All set for the vhost responding to the request. You will want to copy over the relevant section from the default to your new vhost and restart apache:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
service apache2 restart
After that the .htaccess directives should work properly.
If you’re having problems configuring your server to enable mod_rewrite, you might want to try a software stack such as the one used by ServerPilot that enables mod_rewrite by default for your sites.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.