(^o^)/~完美 发表于 2018-11-26 07:57:00

Enable htaccess file work in Apache

  1, Load LoadModule module in Apache
  1) Find the “httpd.conf” file under the “conf” folder inside the Apache’s installation folder.
  2) Find the following line “#LoadModule rewrite_module modules/mod_rewrite.so” in the “httpd.conf” file.You can do this easily by searching the keyword “mod_rewrite” from find menu.
3) Remove the “#” at the starting of the line, “#”represents that line is commented.
4) Nowrestart the apache server.
5) You can see now “mod_rewrite” in the Loaded Module section while doing “phpinfo()”.
  2, Allow override in Apache config file
  Find the Directory for DocumentRoot part, replace AllowOverride None with AllowOverride All.
  3, Place a .htacess file under root directory in project file, and write rewrite rule, a example is:
  #Rules for Versioned Static Files
  Options +FollowSymlinks
  RewriteEngine on
  RewriteRule ^tpl/(js|css)/(.+)\.(.+)\.(js|css)$ tpl/$1/$2.$4
  RewriteRule ^tpl/public/js/(.+)\.(.+)\.js$ tpl/public/js/$1.js [L
  (For rewriting js/css file with last modified time to its really name).



页: [1]
查看完整版本: Enable htaccess file work in Apache