usmannasir / cyberpanel

Cyber Panel - The hosting control panel for OpenLiteSpeed
GNU General Public License v3.0
1.6k stars 613 forks source link

Installing WordPress on a sub-domain NOT updating .htaccess causing 404 on permalinks with no index.php #661

Open fazalfarhan01 opened 3 years ago

fazalfarhan01 commented 3 years ago

First of all, I appreciate all the time and effort put by developers contributing to this great project. I found a bug while installing WordPress on a sub-domain (NOT sub-directory).

Problem:

Installing WordPress automatically updates the .htaccess to make up for rewrites by adding the following lines in .htaccess

### Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

### End CyberPanel Generated Rules.

But the same is not true when WordPress is installed on a sub-domain.

What should actually happen?

The automatic WordPress installer should add the above lines to .htaccess or atleast WordPress should do it when updating the permalinks.

Workaround

I solved the problem by adding the below quoted lines in the .htaccess file manually. No more 404s on URLs not containing index.php.

### Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

### End CyberPanel Generated Rules.
qtwrk commented 3 years ago

Hi, thanks for feedback, just few questions want to clarify...

Did you restart OLS after you set permalink or installed sub-dir WP?

Is that public html htaccess or subdir htaccess?

Did you add it via file manager or rewrite rule button in website page?

fazalfarhan01 commented 3 years ago

Did you restart OLS after you set permalink or installed sub-dir WP?

Yes I did. I even restarted the VM.

Is that public html htaccess or subdir htaccess?

I edited subdir .htaccess

Did you add it via file manager or rewrite rule button in website page?

I used the rewrite rule button in the website https://domain_name.tld:8090/websites/domain_name.tld/subdomain.domain_name.tld page.

And also there's no dropdown to select the rewrite rule template in the child domain page as in the main domain page.

And is to possible to define custom templates per user to be used in future?

Thanks.