Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Using .htaccess to rewrite all pages to www. generates 404 error!


DigitalSky - 9:30 pm on Jul 24, 2012 (gmt 0)


I'm encountering a very odd issue here.

The site I am working on is a Drupal site. I want to make all of the page URLs rewrite to www.mydomain.com instead of simply mydomain.com.

I am attempting to do this by adding this code to the .htaccess file..


Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^mydomain\.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,NC]


That code works on every other site I have perfectly. It doesn't work on my current Drupal site however. Instead, when I add that code to the .htaccess file something odd happens...

The home page of the site does indeed redirect to www.mydomain.com, however, all of the other pages within the site (i.e. [mydomain.com...] generate a 404 Error page.

Once I remove the code all the pages work fine again.

Any idea what is going on here? I can't figure this out for the life of me and it's driving me crazy, especially since I'm usually pretty savvy when it comes to these sorts of things.


Thread source:: http://www.webmasterworld.com/apache/4478550.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com