• Hi guys,

    I have some trouble with installing my website, running on wordpress, on the localhost. I have followed the 2 part of this articles, but it seems it does not work https://www.wpbeginner.com/wp-tutorials/how-to-move-live-wordpress-site-to-local-server/.

    Indeed, when I want to access to my website on my localhost, it downloads a text file. I tried to figure out what is the problem but I did not find out.

    In the same time when I set up the wordpress website on my localhost, it worked perfectly well.

    My site is running with Salient’s theme, I don’t know if it’s helpful ?? On the other side, I was not sure about what I needed to put inside, maybe it’s the reason why it does not work,

    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name_here');
     
    /** MySQL database username */
    define('DB_USER', 'username_here');
     
    /** MySQL database password */
    define('DB_PASSWORD', 'password_here');

    Have a good Day

    Kevin

Viewing 6 replies - 1 through 6 (of 6 total)
  • I am having trouble understanding your description, at times it says it works perfectly well, at others that it downloads a text file.

    First I suggest that you test that your localhost is configured and running, in your browser load URL: <whatever your localhost is called/readme.html
    The WordPress readme file provides a first test. Does it work ?

    You really need to read more instructions about installing WordPress, YES you will need to enter settings for “database_name_here, username password” into
    your wp-config.php file.

    Localhost, what do you mean by that?

    What server environment are you running on your Local computer?

    A computer is not “LocalHost” by default, you have to install a “Host” or Server to serve WordPress… Like MAMP, XAMP, APACHE.

    Thread Starter kevinrabesaotra

    (@kevinrabesaotra)

    I use MAMP, so I found out why it did not work. For now I have another problem. When I go to my website by using localhost, it redirects me to my live site https://example.com. I don’t get why.

    I’ve made differents changes into my database as replacing the “home”, and “urlsite” by the localhost address. In the same time, I did update wp_options and others table. Same in the localhost wp-admin. Can you help me about this issue please?

    htaccess?

    Thread Starter kevinrabesaotra

    (@kevinrabesaotra)

    I guess, but I don’t know what to change. Here the code ??

    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    <FilesMatch "\.(html|htm|rtf|rtx|svg|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|TXT|XSD|XSL|XML)$">
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(bmp|class|doc|docx|eot|exe|ico|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|ICO|WEBP|JSON|MDB|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
        <IfModule mod_headers.c>
             Header unset Last-Modified
        </IfModule>
    </FilesMatch>
    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=W3TC_ENC:_gzip]
        RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
        RewriteRule .* - [E=W3TC_PREVIEW:_preview]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{REQUEST_URI} \/$
        RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
        RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
        RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    </IfModule>
    # END W3TC Page Cache core
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    # php -- BEGIN cPanel-generated handler, do not edit
    # Définissez le package ??ea-php56?? comme langage de programmation ??PHP?? par défaut.
    <IfModule mime_module>
    
    </IfModule>
    # php -- END cPanel-generated handler, do not edit

    Hello Kevin, that is a very impressive .htaccess file, way more complex than any I have used. Please simplify your troubleshooting by turning off the various browser cache and page cache plugins, and if necessary remove these blocks from your .htaccess. Only re-enable them one at a time, with testing after your problem is fixed. Save a copy of the present .htaccess of course.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Localhost installs but download text file whereas it should display the site’ is closed to new replies.