Directory directive error

Discussion in 'Install/Configuration' started by mkultra, Aug 29, 2014.

  1. mkultra

    mkultra New Member

    Trying to port my .htaccess rewrites directly into the server configuration. So on the rewrite tab of the virtual host config I went to the "Rewrite control" section and enabled rewrite. Then in the rewrite rules section I did this...

    <Directory [pasted path of directory containing htaccess file here]>
    [pasted rules from corresponding .htaccess file here]
    </Directory>

    and repeated for each .htaccess file I had. But I get a server error saying "Invalid rewrite directive <Directory ... "
  2. NiteWave

    NiteWave Administrator

    please refer apache's document:
    http://httpd.apache.org/docs/2.2/mod/core.html#directory
    "Context:server config, virtual host"
    Directory directive is not part of rewrite rules, so not work, it should be removed.

    also, rewrite rules here is "per server", while rewrite rules in .htaccess is "per directory", the syntax is a bit different. you can search apache document for more details.
  3. mkultra

    mkultra New Member

    So that's why it doesn't work. But any tips to make it work? I imagine porting .htaccess files into the server config is fairly common. Esp. for people on openlitespeed, which doesn't support .htaccess files. Is there some other way of accomplishing the same thing?
  4. NiteWave

    NiteWave Administrator

    please give a simple example rules in .htaccess, I'll show the "per server" rules. this will make the discuss easier.
    I believe general instruction is well documented in apache's site.
  5. mkultra

    mkultra New Member

    Example .htaccess in /regular:

    Options +FollowSymlinks

    IndexIgnore *

    RewriteCond %{REQUEST_URI} !^/other/all\.php
    RewriteCond %{REQUEST_URI} !^/other/each\.php

    RewriteRule ^(.*)$ standards\.php?original=$1 [QSA,R,L]

    Example .htaccess in /general:

    <Files "general.php">
    Order Allow,Deny
    Deny from all
    </Files>
  6. Michael

    Michael Administrator Staff Member

    Howdy,

    You can find a number of discussions about this on openlitespeed.com. We try to keep OpenLiteSpeed discussion there or on the OpenLiteSpeed Google Group. This is not a common request for LSWS Standard or Enterprise (since people who have Apache configs just use the Apache configs with these editions) and is not that easy to do. The way to do it is to set up a context under your virtual host. The contexts work similarly to the <Directory> tag. Then you use paste your rewrite rules into there.

    Cheers,

    Michael

Share This Page