Rewrite rule for wordpress in subfolder of root

#1
Hi all! First post here....
I had some rewrite rules in apache working without any problem. Here they are:

# BEGIN Wordpress
<IfModule mod_rewrite.c>
RewriteEngine on
# behind proxy
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^http$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
# plain
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^$
RewriteCond %{REQUEST_SCHEME} ^http$ [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
# wordpress in subfolder subf
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !^/subf/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subf/$1
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ subf/index.php [L]
</IfModule>
# END Wordpress

I migrated to Openlitespeed. I saw there is a conversion to be made at the link:

https://open.litespeedtech.com/kb/apache-rewrite-rules-in-openlitespeed/

I tried to modify the rewriterules like the following (and many other ways), but I don't get the syntax right and struggle to find a solution.
I'd like wordpress to be in subfolder subf and when visitor go to mysite.com the website will show wordpress installation in folder mysite.com/subf


# BEGIN Wordpress
<IfModule mod_rewrite.c>
RewriteEngine on
# behind proxy
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^http$
RewriteRule /.*) https://%{HTTP_HOST}/$1 [R=301,L]
# plain
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^$
RewriteCond %{REQUEST_SCHEME} ^http$ [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule /.*) https://%{HTTP_HOST}/$1 [R=301,L]
# wordpress in subfolder subf
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !^/subf/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/.*)$ /subf/$1
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^//)?$ subf/index.php [L]
</IfModule>
# END Wordpress

Any help would be really appreciated, thanks!
 
#3
Thanks, I'll give it a check...meanwhile, thanks to a friend, I was able to get the syntax right and now it's working!!!

The last line - Rewriterule was replaced with

RewriteRule ^/?$ /subf/index.php [L]

and I think other syntax mistakes was corrected below, even if I'm not 100% sure all code is 100% working with openlitespeed:

# BEGIN Wordpress
<IfModule mod_rewrite.c>
RewriteEngine on
# behind proxy
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^http$
RewriteRule /(.*) https://%{HTTP_HOST}/$1 [R=301,L]
# plain
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^$
RewriteCond %{REQUEST_SCHEME} ^http$ [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule /(.*) https://%{HTTP_HOST}/$1 [R=301,L]
# wordpress in subfolder subf
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !^/subf/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /subf/$1
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^/?$ /subf/index.php [L]
</IfModule>
# END Wordpress
 
Top