2014-11-05 2 views
1

/var/www/html/My_project_folder는 내 프로젝트의 경로입니다. .htaccess 파일을 찾지 못했습니다. 편집 한 .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로 파일에 추가이 코드는 내 사이트의 속도를 is--. .htaccess 파일의 위치를 ​​알려주세요. 미리 감사드립니다.

답변

1

일반적으로이 파일은 웹 사이트의 루트 (사용자의 index.php 파일)입니다. 파일이 없으면 새 파일을 만들 수 있습니다. 그러나 메모장 (일반적으로 .txt를 모든 파일에 추가 함)을 사용하여 ".htaccess.txt"와 같은 것을 만들지 않도록 조심하십시오.

0

.htaccess 파일을 프로젝트의 루트에 붙여 넣어야합니다. .htaccess가 숨겨져있을 가능성이 있습니다 ... DM 대신 터미널을 사용하여 폴더를 조사해보고 거기에없는 경우 명령을 사용하여 터미널에서 새 파일을 만들려고합니다.

나노 htaccess로 (리눅스 사용자)
편집 htaccess로 (Windows 사용자) 내 프로젝트의

+0

루트 내가이 htaccess로 파일을 creat에해야 할 프로젝트 폴더 아래에 의미? – Unique

+0

예 "/ var/www/html/My_project_folder"에 정확하게 있습니다. "a2enmod rewrite"를 사용하여 아파치에서 mod를 활성화했는지 확인하십시오. 그렇지 않으면 .htaccess 파일이 쓸모 없게됩니다. –

+0

고맙습니다. 내가 mod를 SSH로 활성화시키는 방법을 알고 있나? – Unique