以下の .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
上記のコードは完璧に機能しています。
問題は、最初のコードが機能しない理由を理解できないことです。
ログ:
[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.