vhost 구성에 mod_rewrite 규칙을 추가하려고하는데 작동하지 않습니다. "mysite.com"사이트의 경우 "/ webmedia /"를 홈 페이지로 리디렉션하고 싶습니다. 당신이 mod_rewrite를로드있는 경우에 작동합니다vhosts 구성의 mod_rewrite
<VirtualHost 192.168.100.142:80>
ServerAdmin [email protected]
DocumentRoot /home/drupal_1
ServerName mysite.com
ServerAlias www.mysite.com
Alias /movies /home/movies/
ErrorLog /var/log/httpd/mysite.com_err_log
CustomLog /var/log/httpd/mysite.com_log special
<Directory /home/drupal_1>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
# Rewrite Rules #####################
RewriteEngine On
RewriteRule ^/webmedia/(.*)/[R=301,L]
# end Rewrite Rules #################
</Directory>
<Directory /home/movies>
Options FollowSymLinks Includes ExecCGI
AllowOverride All
DirectoryIndex index.html index.htm index.php
</Directory>
</VirtualHost>
왜 규칙을'.htaccess' 파일로 옮기지 않으시겠습니까? 모든 수정 후에 Apache를 다시 시작할 필요가 없으므로 관리가 훨씬 쉬워집니다. –
.htaccess 파일이 커지고 있고 서버가 vhosts 파일에서 그것을 읽는 것이 더 효율적이라고 들었습니다. 그 맞습니까? – EricP
예, Apache는 모든 요청에 대해 .htaccess 파일을 읽을 필요가 없으므로 'AllowOverride All'없이 _faster_입니다. 퍼포먼스의 이득은 여기서 매우 작다고 생각합니다. 그것이 당신의'.htaccess'에서 현재 가지고있는 것은 무엇입니까? –