openlitespeed doesn't read multiple redirects using rewriterule from htaccess

donko

Verified User
Joined
Aug 12, 2020
Messages
12
hello i was using on previous version of directadmin with openlitespeed 1.6.15 this on my htaccess, there are multiple rewrite rules each one with different urls


RewriteEngine On
RewriteRule ^/2016/03/hello.html https://www.xxxxxxx.ga/22444/84347 [R=301,L]
RewriteRule ^/2016/03/hello.html https://www.xxxxxxx.ga/22444/84347 [R=301,L]
RewriteRule ^/2016/03/hello.html https://www.xxxxxxx.ga/22444/84347 [R=301,L]
RewriteRule ^/2016/03/hello.html https://www.xxxxxxx.ga/22444/84347 [R=301,L]
RewriteRule ^/2016/03/hello.html https://www.xxxxxxx.ga/22444/84347 [R=301,L]


today, after updating i noticed it was not working none of these, i have cronjob to autoload htaccess, on ols vhost is autoload htaccess and rewrite enabled, also i tried restart ols and rebuild rewrite_config and still not working.

the only way to got it working was adding manually to custom 5 and all of these rules and worked again but i want to know why stopped working from htaccess
 
You don't need to use RewriteEngine On with OLS. Depending how many rewrite rules you have you can just use Site Redirection in DA dashboard and it will add the rewrite rules into the websites openlitespeed.conf file.

If you want to add the rewrite rules into the .htaccess file you will need to make a slight adjustment to your rewrite rules. Give this a try and let me know how you get on.
Code:
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]
 
You don't need to use RewriteEngine On with OLS. Depending how many rewrite rules you have you can just use Site Redirection in DA dashboard and it will add the rewrite rules into the websites openlitespeed.conf file.

If you want to add the rewrite rules into the .htaccess file you will need to make a slight adjustment to your rewrite rules. Give this a try and let me know how you get on.
Code:
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]

Hello thanks for your reply.

I changed all rules as you posted and tried using it on htaccess instead openlitespeed custom 5 config and doesn't work, also my previous rules was working on the htaccess with OLS but after updating directadmin to latest version they are not being readed anymore even if i restart openlitespeed.

Only work if i add manually to openlitespeed config but there is a lot of sites to do it on this way.

I don't see any error on stderr or error.log file


this is my current htaccess

# BEGIN LSCACHE
# END LSCACHE
# BEGIN NON_LSCACHE
# END NON_LSCACHE
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]
RewriteRule ^/2016/03/hello.html/?(.*)$ https://www.xxxxxxx.ga/22444/84347/$1 [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

wordpress permalinks works correctly so i think this part is being readed too, only first is not.
 
Last edited:
That is really strange. On my DA server (1.61.4) with OLS (1.6.15) the rewrite rules are working fine from .htaccess. Are the OLS Stderr and Error Logs empty? Have you checked the domain error log?
Code:
/var/log/httpd/domains/domain.com.error.log
 
Back
Top