Monday, 15 July 2013

apache - "RewriteEngine On" in virtual host not working -



apache - "RewriteEngine On" in virtual host not working -

this virtual host entry.

version: apache/2.2.15 (unix)

<virtualhost *:80> servername web1.net serveralias www.web1.net serveradmin webmaster@web1.net directoryindex index.html index.php loglevel warn errorlog /var/log/httpd/web1.net_error_log customlog /var/log/httpd/web1.net_access_log combined documentroot /web/web1.net/htdocs <directory "/web/web1.net/htdocs"> options indexes followsymlinks includes execcgi order allow,deny allow allowoverride rewriteengine on #this not working </directory> </virtualhost>

.htaccess file

rewriteengine on # works. #abc5 rewritecond %{http_host} ^example\.org$ [nc] rewriterule .* http://www.example.com

when set same (rewriteengine on) in .htaccess file starts working, why need require set in .htaccess when nowadays in virtual host.

do need other changes in apache config?

you need have rewriteengine on in each directory's .htaccess if want enable rewriting. in short:

rewriteengine on server config doesn't come effect documentroot/.htaccess rewriteengine on in documentroot/.htaccess doesn't come effect /subdir/.htaccess

apache .htaccess mod-rewrite virtualhost

No comments:

Post a Comment