I am new to coding so please forgive me if there is a simple solution.
I have just tried to transfer a brand new website to replace an older version using FTP, however when trying to load the index.php page, it downloads the page rather than loading it. Is there something I need to add to my .htaccess file to stop this happening? Or is there another element that I have missed?
This is my current .htaccess file;
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/opentype
# For Olders Browsers Which Can't Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch MSIE !no-gzip !gzip-only-text/html
</IfModule>
#One year for image files
<filesMatch ".(jpg|jpeg|png|gif|ico|webp)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
#One month for css and js
<filesMatch ".(css|js|woff2)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
<IfModule mod_setenvif.c>
#Vary: Accept for all the requests to jpeg and png
SetEnvIf Request_URI ".(jpe?g|png)$" REQUEST_image
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if browser supports WebP images
RewriteCond %{HTTP_ACCEPT} image/webp
# Check if WebP replacement image exists
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
# Serve WebP image instead
RewriteRule (.+).(jpe?g|png)$ $1.webp [T=image/webp]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>
RewriteEngine On
RewriteBase /
# Force SSL
RewriteCond %{SERVER_PORT} ^80$
RewriteRule (.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
ErrorDocument 404 /index.php
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
question from:
https://stackoverflow.com/questions/65830852/index-php-downloading-rather-than-loading 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…