htaccess not working

Hi guys,

When i make .htaccess in my public_html directory it works after restarting lightspeed, however when i make one in subdirectory it is not working and rules are not set.

I am trying to deny execution of php in that folder but standard htaccess that i used in lamp stack worked, is this a bug in LS or?

Comments

  • OpenLiteSpeed does not support all .htaccess directives, you can read more https://cyberpanel.net/2018/09/10/openlitespeed-v1-4-38-has-been-released/
  • Hello, can you help me, I can't post new post to this forum.. I didn't find button or link to do it.. So, I post my problem with cyberpanel here.. I have .htaccess that work well in apache, but when I used it to cyberpanel with openlitespeed, it dosn't work.. I was follow step on https://openlitespeed.org/kb/migrate-apache-rewrite-rules-to-openlitespeed/ , but still didn't work.. Can you hel me?? This is my .htaccess content


    # Turn on URL rewriting
    RewriteEngine On

    # If your website begins from a folder e.g localhost/my_project then
    # you have to change it to: RewriteBase /my_project/
    # If your site begins from the root e.g. example.local/ then
    # let it as it is
    RewriteBase /bia

    # Protect application and system files from being viewed when the index.php is missing
    RewriteCond $1 ^(application|system|private|logs)

    # Rewrite to index.php/access_denied/URL
    RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

    # Allow these directories and files to be displayed directly:
    RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images|img|images)

    # No rewriting
    RewriteRule ^(.*)$ - [PT,L]

    # Rewrite to index.php/URL
    RewriteRule ^(.*)$ index.php/$1 [PT,L]
  • @CyberPanel I was follow that..

    this is my .htaccess on rewrite rule

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/(.*)$ index.php?/$1 [L]

    this is my vHost conf added at the end

    rewrite {
    enable 1
    autoLoadHtaccess 1
    }

    Please help me, I just want to hide 'index.php' and make routing in my codeigniter project based, running normal like it was running on Apache..

  • edited October 31
    Please remove forward slash such as
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
  • @CyberPanel OMG, I was missed that.. Thanks for your reply, it's really help me.. I was try it, and yes, it works.. Thank you very much.. :smiley:
Sign In or Register to comment.
Support CyberPanel CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!