search

Home  >  Q&A  >  body text

Apache rewrites routing and hides index.php in the local environment.

  1. LoadModule rewrite_module modules/mod_rewrite.so of the local httpd.conf file has been turned on

  2. The .htaccess file rewriting rules in the root directory are as follows:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

  1. Already set in the config.php file: 'URL_MODEL' => 2,

Published to the server for access: http://domain name/admin can be accessed correctly, but in the local test environment, access after applying the root directory virtual domain name:
http://inurse.com/admin error reporting:
404 NOT Found
The requested URL /Admin/Org/orgAdd was not found on this server.
I would like to ask why this is? What is the principle of Apache rewriting routing rules (easy-to-understand explanation)?
Another: Rewrite rules have been tried:
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
RewriteRule ^( .*)$ index.php?s=/$1 [QSA,PT,L]

巴扎黑巴扎黑2844 days ago796

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:00:54

    Owner, your configuration seems to be wrong:
    1. The following configuration should be the apache configuration httpd.conf
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    </IfModule>

    2. .htaccess configuration only requires the middle one:
    RewriteEngine on

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

    It is recommended to use the second method;

    reply
    0
  • Cancelreply