.htaccess doesn't work on xampp (windows 7)

前端 未结 4 1588
眼角桃花
眼角桃花 2020-12-19 10:42

I\'m setting my .htaccess file right now to use friendly urls (manually). But, when i go to the url the server shows me Error 404

相关标签:
4条回答
  • 2020-12-19 11:11

    Check in httpd.conf you tag, review this property

    AllowOverride All
    

    AllowOverride authorize use htaccess file.

    0 讨论(0)
  • 2020-12-19 11:36

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    if we want to remove index.php form url .First we create a .htaccess file on root directory of project with out any extension. And add this code in this file and so remove the index.php Application/config/config.php

    0 讨论(0)
  • 2020-12-19 11:38

    Even though mod-rewrite is enabled, by default it is not enabled for .htaccess files.

    Hold Your Breath

    • Open xampp control panel
    • Stop Apache
    • Click the Config button on the Apache row, and select httpd.conf
    • In that file, search for something like xampp/htdocs">
    • A bit lower, you may see a line like this: # AllowOverride All. Remove the #, which is a comment
    • Alternately, search for AllowOverride All, make sure it is in the right section, and remove the comment #
    • Save the file
    • Restart Apache, say a prayer, cross your fingers and hold your breath
    0 讨论(0)
  • 2020-12-19 11:38

    This listing may be old but is still relevant so to make it a little more secure it is probably best to add a few lines.

    Deny from all
    Allow from 127.0.0.1 ::1 localhost
    Allow from .htaccess
    

    Also as a side note .htaccess files slow the speed of the server so it would be best to refer to xampp documentation for best practices.

    Hope it helps.

    0 讨论(0)
提交回复
热议问题