OXID eShop on VirtualBox VM, fun with mod_rewrite

See the posts about developer VM on VirtualBox.

Want to install OXID eShop Community edition .
VM is still missing some stuff, eShop cries for mod_rewrite, curl, GdLib and MySQL client connector.

sudo a2enmod rewrite
sudo apt-get install php5-gd
sudo apt-get install mysql-client
sudo apt-get install php5-mysql
sudo apt-get install libapache2-mod-auth-mysql

After installing and restarting apache eShop only complains that system requirements for mod_rewrite and curl are not completely ok but that installation can progress. Let’s see what happens.

Proceed with installation, chosen country is germany and loading further information from OXserver
is also ok. Install demo data and also use UTF8.

Shop is up and running, at least as far as admin and frontpage are concerned.
Shopurl is set to http://localhost:8090/CE_4_5_0. First click on an article shows that
something’s completely wrong with seo urls in the current configuration.

On Mac we currently call the shop as http://localhost:8090/CE_4_5_0 due to port forwarding.
For now we configure guest VM so that the shop url there is the same (http://myshop:8090/CE_4_5_0). This makes sure we can access the shop under the same url on host and guest. We’ll consider nice looking urls at a later time.

First deal with not working mod_rewrite inside vm.
Something’s wrong with apache mod_rewrite in the current configuration. Shop admin complains that mod_rewrite configuration is not completely ok. So translation for the orange box is in our case: mod_rewrite is installed and loaded by apache but is ignored somehow. Red would be module not installed and we want a green box green for ‘all is well’.

Let’s investigate what function checkModRewrite() in class oxSysRequirements does.
Btw, an assignment inside if () is not really good style if you ask me. Wonder how they got that around codesniffer. Function checkModRewrite() does a call on oxseo.php to check for mod_rewrite’s reaction if any. If opening the ressource fails, php function apache_get_modules (if exists, depending on php version) is called as a fallback.

What happens is a call like http://localhost:8090/CE_4_5_0/oxseo.php?mod_rewrite_module_is=off, if rewrite engine really works as planned in .htaccess, the url with these exact parameters must be rewritten as http://localhost:8090/CE_4_5_0/oxseo.php?mod_rewrite_module_is=on.

The related section in file .htaccess is

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine On
RewriteBase /CE_4_5_0

RewriteRule .* – [F]

RewriteCond %{REQUEST_URI} oxseo\.php$
RewriteCond %{QUERY_STRING} mod_rewrite_module_is=off
RewriteRule oxseo\.php$ oxseo.php?mod_rewrite_module_is=on [L]



Trying to screw up .htaccess on purpose shows that apache seems to happily ignore this file.
Even stronger hint: http://localhost:90/CE_4_5_0/log/index.html should not be accessible if .htaccess works.
Well, whatever index.html contains, it can be accessed in browser. Dammit!

Friend google tells that we need to check for AllowOverride None in the related sites-available files. Changing this to AllowOverride All in section beginning with <Directory> and section beginning with <Directory /htdocs/myshop> does the trick after rebooting apache (whew).

This entry was posted in howto, oxshop and tagged , , , . Bookmark the permalink.

Leave a Reply