2013-07-10 4 views
0

아래 주어진 htaccess로 코드는 내부 오류를500 내부 서버 오류 htaccess로

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

RewriteCond %{HTTP_HOST} !^([w]{3,3}[.]{1,1}){0,1}example.com$ 
RewriteCond %{HTTP_HOST} ^([0-9a-zA-Z-]*)[.]example.com$ 
RewriteRule ^$ portfolio/index.php?id=%1 [NC,L] 

AuthType Basic 
AuthName "If your not authenticated , then go seat in corner" 
AuthUserFile /var/www/devRoot/.htpasswd 
Require valid-user 

를 가져 오는 있습니다하지만 난 위의 코드에만

AuthType Basic 
AuthName "If your not authenticated , then go seat in corner" 
AuthUserFile /var/www/devRoot/.htpasswd 
Require valid-user 

완벽하게 작동하고 사용하고있는 경우.

문제 제 1 코드가 작동하지 않는 이유를 이해할 수 없습니다.

로그 :

[Wed Jul 10 13:12:11 2013] [alert] [client 1.23.112.242] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configur        ation 
[Wed Jul 10 13:12:12 2013] [alert] [client 1.23.112.242] /var/www/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configur        ation 

해결 :

Did you ensure the RewriteEngine is on? 

You'll want to verify that the mod is enabled - just look for rewrite.load symlink in /etc/apache2/mods-enabled. If not, run sudo a2enmod rewrite to enable it. Restart apache using sudo service apache2 restart and provided your .htaccess syntax is correct this will work. 

Otherwise you will need to paste more information about your .htaccess file. 
+0

시작을 찾고. 그런 다음 대신 superuser.com을 고려해보십시오. –

+0

디버깅을 켜는 방법 – user2568637

답변

0

는 재 작성 엔진을 활성화를 havent,/등

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 

당신은 거기에있을 수 있습니다 httpd.conf 파일에서 행의 주석을 해제/apache2/mods-available 경우에만 mods-enabled로 복사하고 다시 시작하십시오.

그게 리눅스라고 가정하니?

창 당신은 디버그 로깅을 켜기로

LoadModule rewrite_module modules/mod_rewrite.so 
+0

RewriteEngine이 켜져 있는지 확인 했습니까? mod가 활성화되어 있는지 확인하고 싶을 것입니다./etc/apache2/mods-enabled에서 rewrite.load symlink를 찾으십시오. 그렇지 않은 경우 sudo a2enmod를 실행하여 다시 활성화하십시오. sudo service apache2 restart를 사용하여 아파치를 다시 시작하고 .htaccess 구문이 올바로 제공되면 이것이 올바르게 동작합니다. 그렇지 않으면 .htaccess 파일에 대한 추가 정보를 붙여 넣어야합니다. – user2568637