简体   繁体   中英

Using htaccess to server from subdirectory

I'm setting up a WordPress development environment and have this idea for directory structure of the DocumentRoot;

.htaccess
tags
  - 2.8
  - 2.9
  - 3.0

My idea is to use mod rewrite to switch between the different tag directories, so far though, I have been unsuccesful in setting it up. Here's what I have so far;

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /tags/3.2/index.php [L]

I have the following in my VirtualHost directive;

AllowOverride all
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
DirectoryIndex index.php

But all I get is the directory listing in the browser with this error message in the apache logs;

[Fri Nov 25 18:44:44 2011] [error] [client 127.0.0.1] client denied by server configuration: /opt/local/apache2/htdocs/vhosts/wordpress/.htaccess

Check this file, that's where Apache is saying that access is being denied from:

/opt/local/apache2/htdocs/vhosts/wordpress/.htaccess

If that's where your VirtualHost directive is then there is something else in that file that is forbidding access. Also remember that when you change a file in the actual Apache directories, it's a good idea to restart Apache to ensure that the change took affect. Sometimes configurations can include general rules which apply to everything, etc. Browse through the entire file and make sure nothing is conflicting with what you're trying to do.

For example, when you install phpMyAdmin, the default .htaccess file that is installed with it is one line reading Deny from all . Took me a good 10-15 minutes to figure that one out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM