Uncluttered Convenience

Icon

the simplest thing that could possibly work

mod_rewrite and mod_alias error? Tweak with RewriteBase.

If you’re using mod_rewrite and mod_alias you may have a small issue getting the rewrites to work correctly (404, no rewrite, wrong site showing). I recently installed a cakephp app in an aliased directory – the pertinent line from /etc/apache2/sites-enabled/000-default (or equivalent):

Alias /projects /path/to/projects
<Directory "/path/to/projects">
...
</Directory>

 

To make mod_rewrite function as expected I had to use the RewriteBase directive in /path/to/projects/project_name/.htaccess (or equivalent):

RewriteBase /projects/project_name

…and that’s it.

Filed under: Fix, , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Recently Bookmarked

Follow

Get every new post delivered to your Inbox.