/var/www/html/ my _ project _folder是我的项目的路径。我没有找到.htaccess文件。我想粘贴我编辑过的.htaccess文件。但是我不确定我需要放在哪个位置?我的htaccess文件代码是--
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year”
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month”
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript这段代码我添加在.htaccess文件中,以加快我的网站的速度。请告诉我.htaccess文件的位置。提前感谢!
发布于 2014-11-05 20:11:39
通常,此文件位于网站的根目录(即index.php文件所在的位置)。如果没有,您可以创建一个新文件。但是,如果您使用记事本(通常会将.txt附加到所有文件),请注意不要创建类似于".htaccess.txt“的东西。
发布于 2014-11-05 20:12:11
您需要将.htaccess文件粘贴到项目的根目录中。有可能你的.htaccess被隐藏了..。尝试使用终端而不是DM查看文件夹,如果不存在,请尝试使用以下命令从终端创建一个新文件。
nano .htaccess (linux用户)
编辑.htaccess (windows用户)
https://stackoverflow.com/questions/26756768
复制相似问题