2

For legacy reasons, I have a wordpress site that primarily lives at a subdirectory: http://www.zmxmusic.com/site . However, it also serves the home page at http://www.zmxmusic.com .

I don't have access to the apache config that's currently used, and I'm having difficulty replicating this behavior on a new server. The wordpress site lives in the filesystem at /srv/zmx/wp/site, and wordpress' home page and siteurl are defined to be http://www.zmxmusic.com/site. I have this in apache config:

<VirtualHost *:80>
  ServerName www.zmxmusic.com
  ServerAlias ...omitted... 
  DocumentRoot /srv/zmx/wp

  <Directory /srv/zmx/wp>
    Options FollowSymLinks
    AllowOverride FileInfo Options
    Order allow,deny
    Allow from all
  </Directory>

  LogLevel info
  ErrorLog /var/log/apache2/zmx_app-error.log
  CustomLog /var/log/apache2/zmx_app-access.log combined

  RewriteEngine On
  Options +FollowSymlinks

  RewriteCond %{REQUEST_URI} !^/(site/|index\.php)
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^(.*)$ /site/$1 [L]
</VirtualHost>

and I'm still getting Access Denied at the root. Suggestions?

EDIT

Nice catch. And I got it working, changed it to:

RewriteCond %{REQUEST_URI} !^/site.*
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^/(.*)$ /site/$1 [L]

Even worked without adding that slash... it seemed to have mainly been the first RewriteCond

(edited because I can't answer my own question yet)

  • Change your RewriteRule to RewriteRule ^/(.*)$ /site/$1 [L] - but I don't think this is the issue. Anything useful in Apache's error log? – Shane Madden Dec 19 '11 at 22:11
  • If you found the answer, please answer to yourself below, then check your answer as "valid" in a few hours ;) – Olivier Pons Dec 20 '11 at 20:27
1

I got it working, changed it to:

RewriteCond %{REQUEST_URI} !^/site.*
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^/(.*)$ /site/$1 [L]

Even worked without adding that slash... it seemed to have mainly been the first RewriteCond

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.