WordPress.org

Ready to get started?Download WordPress

Forums

how to write configuration of htaccess to "virtual host" section in main config? (3 posts)

  1. qdinar
    Member
    Posted 4 years ago #

    how to write configuration of htaccess to "virtual host" section in main config?
    i have tried once, but could not make it working, take in account that rules should change.

    why it is good to do so: apache would not search where .htaccess files exist and would not check whether it is changed, so it would work faster, take in account that searching file is relatively long and it checks subdirectories in path to file for .htaccess files.

  2. qdinar
    Member
    Posted 3 years ago #

    <VirtualHost *:80>
    	ServerName wp.localhost
    	ServerAlias *.wp.localhost
    	ServerAlias .....................
    	DocumentRoot /var/www/localhost/test/wpmu/
    ...
    ...
    ...
    	RewriteEngine On
    	RewriteLogLevel 9
    	RewriteLog /var/log/apache2/rewrite.log
    	<directory /var/www/localhost/test/wpmu/ >
    		#AllowOverride FileInfo Options Indexes
    		AllowOverride None
    
    		# BEGIN WordPress
    		RewriteRule ^index\.php$ - [L]
    		# uploaded files
    		RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    		RewriteCond %{REQUEST_FILENAME} -f [OR]
    		RewriteCond %{REQUEST_FILENAME} -d
    		RewriteRule ^ - [L]
    		RewriteRule . index.php [L]
    		# END WordPress
    	</directory>
    ....
    ...
    ...
    </VirtualHost>

    this does not work, but front page works.

  3. qdinar
    Member
    Posted 3 years ago #

    solved...
    "RewriteEngine On"
    should be both in <VirtualHost *:80>
    and in <directory /var/www/localhost/test/wpmu/ >
    . but when i delete rewritelog directive and other rewrite directives outside of "<directory...", only "RewriteEngine On" in <directory /var/www/localhost/test/wpmu/ > is needed.

Topic Closed

This topic has been closed to new replies.

About this Topic