Reputation: 31
I hosted a flask app on cpanel. The rest of the website was developed on wordpress only one path led to a flask app. The flask app was working fine initially but the the wordpress path were not working correctly. My boss contacted the hosting provider and they changed the .htaccess file. After changing the .htacess file the hompage of my the flask app is rendering but other templates are not rendering (it says page not found). When I even try to make html changes in the home page the app detects it but the problem is still there for the other paths in the flask app, yet it works fine locally. Also the images in the static folder are also not rendering. I have tried tweaking the .htaccess file but not have found no luck yet. If anyone knows how I can get the app to work to would be tremendous help. I have added the current .htaccess file below.
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php81” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
# Skip Flask app directory
RewriteRule ^app_name - [L]
# WordPress rules (no additional custom rules here by default)
# Flask app rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^app_name/(.*)$ /path/to/flask/app/$1 [L]
Upvotes: 0
Views: 65
Reputation: 31
I figured out the problem flask app rules at the bottom were being overwritten by the WordPress rules at the top.
I tried moving the flask apples to the top of .htaccess.
Upvotes: 0