I was running a wordpress site at "mydomain.com" with a whmcs installation at mydomain.com/portal. everything was fine. I recently got rid of the wordpress installation and set up a Django website at mydomain.com. The WHMCS installation at mydomain.com/portal is still there.
But here is the issue:
- visiting mydomain.com/portal is giving me 404 error
- same thing for mydomain.com/portal/admin (404 error)
the pages load if i visit mydomain.com/portal/index.php or mydomain.com/portal/login
My current .htaccess file in mydomain.com:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN
PassengerAppRoot "/home/user/mydomain.com"
PassengerBaseURI "/"
PassengerPython "/home/usr/virtualenv/mydomain.com/3.9/bin/python"
# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END
# Newly added text below here, in order to troubleshoot CSS not showing up
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^static/(.*)$ /home/usr/mydomain.com/staticfiles/$1 [QSA,L,NC]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^media/(.*)$ /home/usr/mydomain.com/blog_images/$1 [QSA,L,NC]
</IfModule>
<FilesMatch "\.(?i:ico|flv|jpg|jpeg|png|gif|js|css)$">
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
</IfModule>
FileETag MTime Size
</FilesMatch>
I tried adding the below but it did not help.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/portal/
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
I am trying to get the whmcs installation to load like it used to at mydomain.com/portal instead of having to link to index.php
You have transitioned from a WordPress site to a Django site, the .htaccess rules might need some adjustments to accommodate the new setup. Here's a revised version of your .htaccess file that should direct requests to the WHMCS installation properly:
"RewriteRule ^portal(.*)?$ /portal/index.php [L]" should redirect any requests to /portal to /portal/index.php, allowing WHMCS to handle the routing internally as it did before.