.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

Web Developer, Business Analytics, Data Engineer specialising in PHP and Tableau

Based in Melbourne, Australia

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

Leave a comment

Name Notify me of replies by email.