.htaccess and Apache VirtualDocumentRoot

If you using VirtualDocumentRoot in your Apache set you need to make a minor change to your .htaccess rewrites to make them work 

  • just add a slash before the url and it’ll work, refer below

from: 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ index.php?module=$1&view=$2 [L]</span>

to: 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ /index.php?module=$1&view=$2 [L]</span>

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me justin@kelly.org.au or _justin_kelly