Issue
I'm trying to force WWW. in Apache's httpd.conf file, not .htaccess, to increase performance. However, when I paste these lines into the first line of httpd.conf, and restart the server, Apache says, "The requested operation failed!".
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Why is this happening, and how can I fix this?
Solution
Seems like you're trying to start rewriting without loading the modules. This sort of thing is generally better to configure in a VirtualHost at any rate, as you're mapping a rewrite for a certain site. The error you get basically just means you have a syntax error.
<VirtualHost *:80>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
</VirtualHost>
Answered By - Josh from Qaribou Answer Checked By - Timothy Miller (WPSolving Admin)