.htaccess not working on localhost with XAMPP

前端 未结 9 1421
北荒
北荒 2020-11-27 20:49

i m using XAMPP but i m not able to use .htaccess file at local host. i m trying so many times.. Online working good. but local host showing [The requested URL was n

9条回答
  •  暖寄归人
    2020-11-27 21:32

    Without seeing your system it's hard to tell what's wrong but try the following (comment answer if these didn't work WITH log error messages)

    [STOP your Apache server instance. Ensure it's not running!]

    1) move apache server/install to a folder that has no long file names and spaces

    2) check httpd.conf in install\conf folder and look for AccessFileName. If it's .htaccess change it to a file name windows accepts (e.g. conf.htaccess)

    3) double-check that your htaccess file gets read: add some uninterpretable garbage to it and start server: you should get an Error 500. If you don't, file is not getting read, re-visit httpd.conf file (if that looks OK, check if this is the only file which defines htaccess and it's location and it does at one place -within the file- only; also check if both httpd.conf and htaccess files are accessible: not encrypted, file access rights are not limited, drive/path available -and no long folder path and file names-)
    STOP Apache again, then go on:
    4) If you have IIS too on your system, stop it (uninstall it too if you can) from services.msc

    5) Add the following to the top of your valid htaccess file:
    RewriteEngine On
    RewriteLog "/path/logs/rewrite.log" #make sure path is there!
    RewriteLogLevel 9

    6) Empty your [apache]\logs folder (if you use another folder, then that one :)

    7) Check the following entries are set and correct:
    Action application/x-httpd-php "c:/your-php5-path/php-cgi.exe"
    LoadModule php5_module "c:/your-php5-path/php5apache2.dll"
    LoadModule rewrite_module modules/mod_rewrite.so
    Avoid long path names and spaces in folder names for phpX install too!

    8) START apache server

    You can do all the steps above or go one-by-one, your call. But at the end of the day make sure you tried everything above!
    If system still blows up and you can't fix it, copy&paste error message(s) from log folder for further assistance

提交回复
热议问题