Forum Moderators: phranque
I have the following block of code in my httpd.conf file:
<Directory />
Options FollowSymLinks
AllowOverride All
# Begin Rewrite Code
Options +FollowSymLinks
RewriteEngine on
# if hostname is not blank
RewriteCond %{HTTP_HOST} .
# and if hostname does not start with "www."
RewriteCond %{HTTP_HOST}!^www\.
# prepend "www." to hostname and redirect
RewriteRule ^/(.*)$ [%{HTTP_HOST}...] [R=301,L]
</Directory>
I have checked over this, and had some "experts" look over it, and it should be 301 redirecting [site.com...] to [site.com...]
What I stop apache and restart, then test it, it does nothing. What could it be in apache config that isn't allowing these rules to run? I've checked everything!
Thanks,
Dan
Other than that, the only other thing to ask is whether mod_rewrite is installed and enabled on this server -- Maybe try a simpler rule like
RewriteRule ^/foo\.html$ http://www.example.com/bar.html [R=301,L]
to be sure.
Jim
Thanks for the response! It could possibly be the lack of the "space". I'll check it out. Additionally, as far as making sure mod_rewrite is enabled...I have some .htaccess files on sites on this dedicated server mod rewriting fine...does that mean Mod_Rewrite is also enabled at the httpd.conf level, or is there a different setting for this entirely?
Basically, what are the requirements for mod rewrite to work at the httpd.conf level? I just want to make sure there is nothing I am missing...
Let me know when you get a moment.
Thanks!
Dan