Moving from nginx, have some questions

tjk

New Member
#1
Hey All,

Coming from the nginx world, I've been playing with OLS due to the faster php processing.

Two questions:

1. One of the apps I am testing, uses a .htaccess in a ton of directories that simply has "deny from all" in it. Where/what is the proper way through OLS to protect these directories that are using .htaccess today?

2. They use the below .htaccess rule to make friendly url's, and I've tried for hours to get it working in the rewrite section of the virtual host I setup, but keep getting 404 errors. Is there a parser that will take apache htaccess rules and convert them to OLS like there is for nginx?

Any help with the below would be appreciated!

Thanks,
Tom

Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Rewrite application /blog/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^blog/(.*)$ blog/index.php?$1 [L,QSA]
# Rewrite application /calendar/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^calendar/(.*)$ calendar/index.php?$1 [L,QSA]
# Rewrite application /gallery/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^gallery/(.*)$ gallery/index.php?$1 [L,QSA]
# Rewrite application /filebase/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^filebase/(.*)$ filebase/index.php?$1 [L,QSA]
# Rewrite application /forum/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^forum/(.*)$ forum/index.php?$1 [L,QSA]
# Rewrite application /cms/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^cms/(.*)$ cms/index.php?$1 [L,QSA]
# Rewrite application /wcf/
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^wcf/(.*)$ wcf/index.php?$1 [L,QSA]
# Rewrite application /
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</IfModule>
 

lsfoo

Administrator
#2
Hi @tjk

Apologies for the late reply, it seems your message got caught in the spam filter.

Do you have an example of the 'deny from all' rules you are referring to? If you mean that an entire subdirectory is deny from all, you can create a context and deny access from all IPs.

As for your friendly urls, first, you can set rewrite logging to 9. This will output how the rules were processed during the request. One thing that I think you may have hit is that when matching for a RewriteRule, you may have to insert a starting '/'.

So for example,
Code:
RewriteRule ^cms/(.*)$ cms/index.php?$1
should be
Code:
RewriteRule ^/cms/(.*)$ cms/index.php?$1
(The second one may also need to have a slash at the beginning, but I'm 80% sure that's not needed)

Let us know how it goes!

Cheers,
Kevin
 
Top