Rewrite: RewriteRule for subfolder without RewriteBase

#1
Good day all,

I've just installed OpenLiteSpeed and it seems to work fine :) My current issue is with the redirection rules. Installing Wordpress or Jumla or any CMS mostly requires to add Rewrite rules in the admin panel. I haven't figured out how to modify it to make it work for subfolders.

That's why wordpress would tell me to do: Add the following into your .htaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
The point is as I read RewriteBase does not work in vhost (or httpd.conf). I modified to the following:
Code:
RewriteRule ^wordpress/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /wordpress/.* /wordpress/index.php [L]
It looks working for /wordpress/xxx/index.php but not when I access the blog root page /wordpress/index.php.
Any idea please ? I I missed something... Any help are welcomed :)
 
#2
Took me some times, actually I created a specific Context, add index.php in the index files setting and change the rewrite rules to proper ones
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /wordpress/. /wordpress/index.php [L]
 

lsmichael

Active Member
#3
Good job! This is exactly the way to do it. If you need per-directory configurations in OpenLiteSpeed, they are configured using contexts.

(We do plan, though, to make it easier to set up common applications with OpenLiteSpeed. OpenLiteSpeed is coming along well, but we need to make it easier.)

m
 
Top