Pseudo-Static: The request of dynamic Web pages disguised as static web pages
To use pseudo-static technology, to enable pseudo-static modules in httpd.conf:
LoadModule Rewrite_module modules/mod_rewrite.so
Remove the # from the front.
The rewrite rule is usually written in the. htaccess file when the URL is rewritten using the Apache rewrite module. However, to enable Apache to read the contents of the. htaccess file properly, you must configure the directory where the. htaccess is located. From a security consideration, the AllowOverride property of the root directory is generally configured to not allow any override, i.e.
<directory/> allowoverride None Require all denied</Directory>
When AllowOverride is set to None, the. htaccess file is completely ignored, and all instructions with the ". htaccess" Scope are allowed to appear in the. htaccess file when this directive is set to all.
My documentroot:
" /www "
ls -a ... .. htaccess index.htm[email protected]:cat^ (. *) \.html$ $1. Htm[email Protected]:cat[email protected]:
. htaccess Rules:
Rewriteengine on #开启伪静态
Rewriterule ^ (. *) \.html$When a file ends in a. htm #当访问以. html, it is routed to the address of (. *). htm, for example:
Access to http://localhost/index.html-----> is interpreted by the rules as http://localhost/index.htm so that the contents of the index.htm file under the WWW directory are read.
For pseudo-static to take effect, you need to set the/www directory to
Options Indexes FollowSymLinks
AllowOverride Allrequire All granted
My httpd.conf configuration:
1. Remove comments and blank lines from httpd.conf
grep " ^\s*# " grep " ^$ " > Httpd.conf.bak
2,httpd.conf Full configuration:
ServerRoot"/usr/local/httpd24"Listen theLoadModule mpm_prefork_module Modules/mod_mpm_prefork.soloadmodule authn_file_module Modules/mod_authn_file.soloadmodule authn_core_module Modules/mod_authn_core.soloadmodule authz_host_module Modules/mod_authz_host.soloadmodule authz_groupfile_module Modules/mod_authz_groupfile.soloadmodule authz_user_module Modules/mod_authz_user.soloadmodule authz_core_module Modules/mod_authz_core.soloadmodule access_compat_module Modules/mod_access_compat.soloadmodule auth_basic_module Modules/mod_auth_basic.soloadmodule reqtimeout_module Modules/mod_reqtimeout.soloadmodule filter_module Modules/mod_filter.soloadmodule mime_module Modules/mod_mime.soloadmodule log_config_module Modules/mod_log_config.soloadmodule env_module Modules/mod_env.soloadmodule headers_module Modules/mod_headers.soloadmodule setenvif_module Modules/mod_setenvif.soloadmodule version_module Modules/mod_version.soloadmodule unixd_module Modules/mod_unixd.soloadmodule status_module Modules/mod_status.soloadmodule autoindex_module Modules/mod_autoindex.so<ifmodule!mpm_prefork_module></ifmodule><ifmodule mpm_prefork_module></ifmodule>LoadModule dir_module Modules/mod_dir.soloadmodule alias_module Modules/mod_alias.soloadmodule rewrite_module Modules/mod_rewrite.so<ifmodule unixd_module>User daemongroup Daemon</IfModule>ServerAdmin [Email protected]servername127.0.0.1<directory/>allowoverride None Require all denied</Directory>DocumentRoot"/www"<directory"/www">Options Indexes followsymlinks allowoverride all Require all granted</directory><ifmodule dir_module>DirectoryIndex index.html</ifmodule><files". ht*">Require all denied</Files>errorlog"Logs/error_log"LogLevel warn<ifmodule log_config_module>Logformat"%h%l%u%t \ "%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\""combined Logformat"%h%l%u%t \ "%r\"%>s%b"Common<ifmodule logio_module>Logformat"%h%l%u%t \ "%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\"%I%O"Combinedio</IfModule>Customlog"Logs/access_log"Common</ifmodule><ifmodule alias_module>Scriptalias/cgi-bin/"/usr/local/httpd24/cgi-bin/"</ifmodule><ifmodule cgid_module></ifmodule><directory"/usr/local/httpd24/cgi-bin">allowoverride None Options none Require all granted</directory><ifmodule headers_module>requestheader unset Proxy early</ifmodule><ifmodule mime_module>Typesconfig/etc/httpd24/mime.types AddType Application/x-Compress. Z AddType Application/x-gzip. gz. tgz</ifmodule><ifmodule proxy_html_module>Include/etc/httpd24/extra/proxy-html.conf</ifmodule><ifmodule ssl_module>sslrandomseed startup Builtinsslrandomseed Connect builtin</IfModule>
For pseudo-Static, the main note is whether the pseudo-static module is loaded, the settings under directory
apache2.4.33 pseudo-static configuration Getting Started Tutorial (1)