Apache rewrites routing and hides index.php in the local environment.
巴扎黑
巴扎黑 2017-05-16 16:58:54
0
1
714
  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]

巴扎黑
巴扎黑

reply all(1)
曾经蜡笔没有小新

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;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!